Skip to content

Instantly share code, notes, and snippets.

@ricardosiri68
Last active April 11, 2016 01:19
Show Gist options
  • Save ricardosiri68/731ec8efdedcc5e75b19c42f4fdb4a35 to your computer and use it in GitHub Desktop.
Save ricardosiri68/731ec8efdedcc5e75b19c42f4fdb4a35 to your computer and use it in GitHub Desktop.
'''crear un algoritmo que al introducir un monto determiando me salgan la
cantidad de billetes de 500 100 50 5 y 1'''
def separar_billetes(monto):
'''separa los billetes segun su denominacion'''
for denominacion in (500, 100, 50, 5, 1):
if denominacion <= monto:
resto = monto % denominacion
yield denominacion, monto // denominacion
monto = resto
def main():
'''metodo principal del modulo'''
data = int(input('ingrese el monto en pesos $ '))
for denominacion, cantidad in separar_billetes(data):
print("de $ %(denominacion)6.2f hay %(cantidad)4s billetes en un total "
"de $ %(importe)8.2f" % {
'denominacion': denominacion,
'cantidad': cantidad,
'importe': denominacion * cantidad})
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment