Advertisement
hackloper775

Mascotas

Apr 17th, 2013
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. class Mascota(object):
  4.     def __init__(self,nombre,hambre,limpio):
  5.         self.nombre = nombre
  6.         self.limpio = limpio
  7.         self.hambre = hambre
  8.     def tiene_hambre(self):
  9.         if self.hambre == True:
  10.             print ("%s tiene hambre" %(self.nombre))
  11.         else:
  12.             print ("No tiene hambre %s" %(self.nombre))    
  13.     def limpiar(self):
  14.         if self.limpio == True:
  15.             print ("%s necesita limpieza" %(self.nombre))
  16.         else:
  17.             print ("Todo limpio con %s" %(self.nombre))
  18.  
  19. animal1 = Mascota("Nombre1",True,False)
  20. animal1.tiene_hambre()
  21. animal2 = Mascota("Nombre2",True,False)
  22. animal2.tiene_hambre()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement