-
-
Save parzibyte/92647d028e355eef95c96f2fb4b9bb40 to your computer and use it in GitHub Desktop.
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
monedas_con_equivalencias = { | |
"usd": 1, | |
"mxn": 20, | |
"eur": 0.81, | |
"cad": 1.29, | |
"btc": 0.000088 | |
} | |
print("Monedas disponibles:") | |
for moneda in monedas_con_equivalencias: | |
print(moneda) | |
nombre_moneda_origen = "" | |
nombre_moneda_destino = "" | |
while nombre_moneda_origen not in monedas_con_equivalencias: | |
nombre_moneda_origen = input("Moneda origen: ") | |
while nombre_moneda_destino not in monedas_con_equivalencias: | |
nombre_moneda_destino = input("Moneda destino: ") | |
cantidad = float(input(f"Ingresa la cantidad de {nombre_moneda_origen}: ")) | |
equivalencia_origen = monedas_con_equivalencias[nombre_moneda_origen] | |
equivalencia_destino = monedas_con_equivalencias[nombre_moneda_destino] | |
equivalencia = (equivalencia_destino/equivalencia_origen)*cantidad | |
print(f"{cantidad:.2f} {nombre_moneda_origen} equivale a {equivalencia:.2f} {nombre_moneda_destino}.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment