0

python oop

is there something wrong with this code?? class Person: def __init__(self, name): self.name = name def greeting(self): # Should return "hi, my name is " followed by the name of the Person. return "hi my name is {}".format(self.name) # Create a new instance with a name of your choice some_person = Person("Amanillah") # Call the greeting method print(some_person.greeting()) Here is your output: hi my name is Amanillah Not quite. Did you properly create a new instance of the Person class and then assign it a name? Perhaps you forgot to call the greeting() function? this keeps popping up when compiling the code

19th Feb 2022, 1:45 AM
Amanillah Mansuri
Amanillah Mansuri - avatar
0 Resposta