Skip to content

Instantly share code, notes, and snippets.

@alcemirfernandes
Created January 29, 2014 01:31
Show Gist options
  • Save alcemirfernandes/8680025 to your computer and use it in GitHub Desktop.
Save alcemirfernandes/8680025 to your computer and use it in GitHub Desktop.
pintinho
class Bicho():
def __init__(self, nome, som):
self.nome = nome
self.som = som
self.sexo = 'a' if nome[-1] == 'a' else 'o'
pintinho = Bicho('Pintinho', 'Piu')
bichos = [Bicho('Galinha', 'có!'), Bicho('Galo', 'cocó!'),
Bicho('Peru', 'glu glu!'), Bicho('Gato', 'miau!'),
Bicho('Cachorro', 'au au!'), Bicho('Vaca', 'mó!'),
Bicho('Boi', 'mú!'), Bicho('Nenêm', 'gugu!'),
Bicho('Pato', 'quá!'), Bicho('Viado', 'ai ai!'),
]
print(('Minha sogra tinha um %s\n' % pintinho.nome) * 2)
print('De noite o %s %s %s %s' % (pintinho.nome, pintinho.som, pintinho.som, pintinho.som))
print('E o %s? %s %s %s!' % (pintinho.nome, pintinho.som, pintinho.som, pintinho.som))
for n, bicho in enumerate(bichos):
for i in range(1, 3):
print("Minha sogra tinha um%s %s" % ('' if bicho.sexo == 'o' else bicho.sexo, bicho.nome))
print("De noite %s" % bicho.sexo, end='')
print(" %s %s" % (bicho.nome, bicho.som))
for j in range(n-1, -1, -1):
print("e %s %s %s" % (bichos[j].sexo, bichos[j].nome, bichos[j].som))
for i in range(1, 3):
print("E o %s?" % pintinho.nome, end='')
for k in range(1, 4):
print(" %s" % pintinho.som, end='')
print("!")
@alcemirfernandes
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment