Files
python/concepts/binary-octal-hexadecimal/introduction.md
BethanyG 185fbdfac9 Random grammar, spelling and content edits. (#3581)
[no important files changed]
2023-12-27 06:02:10 -08:00

696 B

binary, octal, hexadecimal

Binary, octal, and hexadecimal (also known as hex) are different numeral systems with different bases. Binary is base 2, octal is base 8, and hexadecimal is base 16. Normal integers are base 10 in python. Binary, octal, and hexadecimal literals are all considered int subtypes and Python automatically converts between them. This means that they can only represent zero, positive, and negative numbers that do not have a fractional or decimal part. Binary, octal, and hexadecimal numbers support all integer operations. However, division (as with ints) will return a float.