-
-
Save parzibyte/49b71f34755d153eda2a6c8776fac070 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
def solicitar_datos_a_usuario(): | |
bases_soportadas = ["2", "8", "10", "16", ] | |
base_origen = input(""" | |
2 - Binario | |
8 - Octal | |
10 - Decimal | |
16 - Hexadecimal | |
Elige la base desde donde conviertes: [2, 8, 10, 16]: """) | |
if base_origen not in bases_soportadas: | |
print("La base que ingresaste no está soportada") | |
return | |
numero = input( | |
f"Ok, vas a convertir desde la base {base_origen}. Ingresa el número a convertir: ") | |
base_destino = input(""" | |
2 - Binario | |
8 - Octal | |
10 - Decimal | |
16 - Hexadecimal | |
Elige la base a la que conviertes: [2, 8, 10, 16]: """) | |
if base_destino not in bases_soportadas: | |
print("La base de destino no está soportada") | |
return | |
return (base_origen, numero, base_destino) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment