Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created December 15, 2020 05:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/49b71f34755d153eda2a6c8776fac070 to your computer and use it in GitHub Desktop.
Save parzibyte/49b71f34755d153eda2a6c8776fac070 to your computer and use it in GitHub Desktop.
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