Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- class Mascota(object):
- def __init__(self,nombre,hambre,limpio):
- self.nombre = nombre
- self.limpio = limpio
- self.hambre = hambre
- def tiene_hambre(self):
- if self.hambre == True:
- print ("%s tiene hambre" %(self.nombre))
- else:
- print ("No tiene hambre %s" %(self.nombre))
- def limpiar(self):
- if self.limpio == True:
- print ("%s necesita limpieza" %(self.nombre))
- else:
- print ("Todo limpio con %s" %(self.nombre))
- animal1 = Mascota("Nombre1",True,False)
- animal1.tiene_hambre()
- animal2 = Mascota("Nombre2",True,False)
- animal2.tiene_hambre()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement