Skip to content

Instantly share code, notes, and snippets.

@fchevitarese
Last active February 20, 2017 13:14
Show Gist options
  • Save fchevitarese/1d2b6aad5ee0bfc94c7a82485bf79e4b to your computer and use it in GitHub Desktop.
Save fchevitarese/1d2b6aad5ee0bfc94c7a82485bf79e4b to your computer and use it in GitHub Desktop.
Canta a musiquinha do elefante que incomoda muita gente.
"""Música do elefante.
Digite a quantidade de vezes que vai contar, preferencialmente um número par.
"""
elefantes = int(input('Digite quantos elefantes quer contar: '))
ini = '{0} {1} {2} muita gente!'
ini_plural = '{0} elefantes {1}muito mais!'
for i in range(0, elefantes + 1):
if i == 0:
continue # Ignorando o zero, porque zero elefantes não incomodam =D
if i == 1:
print(ini.format(i, 'elefante', 'incomoda'))
else:
if i % 2 != 0:
print(ini.format(i, 'elefantes', 'incomodam'))
else:
print(ini_plural.format(i, 'incomodam, ' * i))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment