Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Digital Literacy Computer Basics Computer Basics Binary

00000111 I can't figure out what this represents, and why. I'm clearly a beginner.

I got the first two questions right - 00000001 = 1 and 00000011 = 3 I can't however, get this one right: 00000111

1 Answer

Think about decimal notation.

If we had a number 7243:

We have a 7 in the thousands place, a 2 in the hundreds place, a 4 in the tens place, and a 3 in the ones place.

This means (7 * 1000) + (2 * 100) + (4 * 10) + (3 * 1) = Seven thousand two hundred and forty three.

Binary is similar, except instead of being able to put 10 digits in each spot (0 - 9) like in decimal notation, we can only put 2 (0-1).

So instead of having a ones, tens, hundreds, thousands, ten thousands places and so on we have:

ones, twos, fours, eights, sixteens, thirty seconds, sixty fours, and one hundred and twenty eights for the eight spaces in the example.

So, having a '1' in each of the four, two, and one places means 4 + 2 + 1 which equals 7!

If we wanted eight it would be 00001000 (a '1' in the eights place), all other numbers carry over. Just like going from 9999 to 10000.

pet
pet
10,908 Points
 1   1  1  1  1  1  1  1
 =   =  =  =  =  =  =  =
128 64 32 16  8  4  2  1

11111111 = 255
00011100 = 28

hope this helps :)