Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created May 27, 2021 16:13
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/a438f12874621b0942cab909e74849cc to your computer and use it in GitHub Desktop.
Save parzibyte/a438f12874621b0942cab909e74849cc to your computer and use it in GitHub Desktop.
decimal = 3722.24
en_binario = decimal_a_cualquier_base(decimal, 2, "01")
en_octal = decimal_a_cualquier_base(decimal, 8, "01234567")
en_hexadecimal = decimal_a_cualquier_base(decimal, 16, "0123456789ABCDEF")
print(f"El decimal {decimal} es {en_binario} en binario, {en_octal} en octal y {en_hexadecimal} en hexadecimal")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment