Question OOP-CTOR-0033
EasyWhat is the output of this code?
class P:
def __init__(self, n="Guest"):
self.n = n
print(P().n, P("Asha").n)
- A.
Error
- B.
Guest Asha
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Constructors and Destructors question
What is the output of this code?
class P:
def __init__(self, n="Guest"):
self.n = n
print(P().n, P("Asha").n)
Error
Guest Asha
Sign up free to see the answer and a step-by-step explanation.
Guest Guest
Asha Asha