0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 4
click for more info
No active XP Potion
Accept a Quest
Login to submit answers
Binary numbers are just "base 2" numbers. They work the same way as "normal" base 10 numbers, but with two symbols instead of ten.
0
and 1
0
, 1
, 2
, 3
, 4
, 5
, 6
, 7
, 8
, 9
Each 1
in a binary number represents an ever-greater multiple of 2. In a 4-digit number, that means you have the eights place, the fours place, the twos place, and the ones place. Similar to how in decimal you would have the thousands place, the hundreds place, the tens place, and the ones place.
You can write an integer in Python using binary syntax using the 0b
prefix:
print(0b0001)
# Prints 1
print(0b0101)
# Prints 5
Leading 0s are often added for visual consistency but do not change the value of a binary number.
What's the largest decimal number you can store in 5 digits of binary?