Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- """
- Este código permite generar una tabla a partir de un rango de decimales
- para convertirlos a diferentes bases.
- Convenciones:
- Decimal (base 10) --> 0d
- Hexadecimal(base 16) --> 0x
- Octal (base 8) --> 0o
- Binario (base 2) --> 0b
- """
- # pylint: disable=consider-using-f-string
- print(
- "{0:>8s} {1:>9s} {2:>9s} {3:>9s}".format("0d", "0x", "0o", "0b"),
- "\n",
- (chr(8212)) * 39,
- )
- for num in range(1, 32):
- for base in "dXob":
- print("{0:{width}{base}}".format(num, base=base, width=8), end=" |")
- print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement