Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created April 23, 2019 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/a7c37a242c6aeb0c45b9423095069359 to your computer and use it in GitHub Desktop.
Save parzibyte/a7c37a242c6aeb0c45b9423095069359 to your computer and use it in GitHub Desktop.
class Mascota():
nombre = ""
edad = 0
def __init__(self, nombre, edad):
self.nombre = nombre
self.edad = edad
# Aquí pueden ir más cosas que se hacen en un constructor
def saludar(self):
print("¡Hola! Me llamo {} y mi edad es {}".format(
self.nombre, self.edad))
mascota = Mascota("Maggie", 3)
mascota.saludar()
otra_mascota = Mascota("Snowball", 1)
otra_mascota.saludar()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment