Object-Oriented Trace Flashcards
1
Q
What method initializes the object’s attributes when you create an object from a class?
A
__init__ method
2
Q
If p1 = Person(“Alice”), what does p1.name return?
A
“Alice”
3
Q
What output does p1.greet() produce if it calls return f”Hello, my name is {self.name}!”?
A
“Hello, my name is Alice!”