Binary

Binary is the base-2 number system computers use, made of only two digits: 0 and 1. Each digit is a bit, and all data is ultimately stored as binary.

General Programming

In binary, place values double each step (1, 2, 4, 8, ...) instead of multiplying by ten. The binary 1010 equals 8 + 2 = 10 in decimal.

Examples

Python

print(0b1010)        # binary literal
print(bin(10))       # decimal to binary

Output:

10
0b1010

See also

Back to the Dictionary