Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
for each decimal over to the right is one so 00001 is 1 and 00010 is two. so wouldn't 000111 be 1+2+3=6?
just a little confused
Brad Stoltey Good question! Binary can be a bit confusing to figure out, especially at first. Afterall, it's a language for the computers and humans are definitely NOT computers... To hopefully help you understand this a little better, let's look at how a binary counter iterates from 0 to 10:
We'll start with 8 bits (1 byte): 00000000
- 0 = 00000000
- 1 = 00000001
- 2 = 00000010
- 3 = 00000011
- 4 = 00000100
- 5 = 00000101
- 6 = 00000110
- 7 = 00000111
- 8 = 00001000
- 9 = 00001001
- 10 = 00001010
As I said, binary can be tricky. Basically, the further that first 1 gets shifted to the left, the larger the number. For example, if we continue on from 10...
- 11 = 00001011
- 12 = 00001100
- 13 = 00001101
- 14 = 00001110
- 15 = 00001111
- 16 = 0001000
If you need any additional help explaining this better, here is a resource I found that goes in depth on how binary works and it might be able to help answer any of those questions.
Also, for kicks and giggles, here is a project I made years ago that might help you visualize how this works.
Hope that helps!
Steven Parker221,451 Points
You are correct that 00001 is 1 and 00010 is two. But 00100 is 4, so 1 + 2 + 4 = 7.