I have the following code:
My problem is that the console output shows me an error that says:
AttributeError: type object 'Person' has no attribute 'say hello' ()
Why does that happen and how can I solve it?
You have an indentation problem. The methods of a class must go "inside" of it. Try indenting:
class Persona:
nombre = " "
edad = 0
pais = " "
def saludar(self):
print("Hola mi mombre es", self.nombre)
def otroMetodo(self):
...
Python uses the indentation a lot and you must take care of it, so that the Person class has the greeting method, you must place your code in the following way
class Persona:
nombre = " "
edad = 0
pais = " "
def saludar(self):
print("Hola mi nombre es", self.nombre)
also with the other method