python oop | Sololearn: Learn to code for FREE!

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

2/19/2022 1:45:23 AM

Amanillah Mansuri

1 Answer

New Answer