Created
January 29, 2014 01:31
-
-
Save alcemirfernandes/8680025 to your computer and use it in GitHub Desktop.
pintinho
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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("!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://desciclopedia.org/wiki/Linguagem_Python