Is the following code correct? If so, what is the printout?
1 def main():
2 a = A()
3 a.print()
4
5 class A:
6 def __init__(self, newS = "Welcome"):
7 self.__s = newS
8
9 def print(self):
10 print(self.__s)
11
12 main() # Call the main function
Sorry the answer is not available at the moment…
If you are able to find the answer, please make sure to post it here. So that your Juniors have smile on their lips and feel happy.
Spread the 'tradition of sharing'.