class Person:
def __init__(self, name):
self.name =name
def say_hello(self):
print(f"Hello, my name is {self.name}!")
person1 =Person("Alice")
person1.say_hello()
AttributeError: ‘Person’ object has no attribute ‘say_hello’
For some reason I keep getting the attribute error. I dont know what I am doing wrong because I am following the code exactly how I see it.
New contributor
Selorm Ganyo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1