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 trialSaadia Fattah
1,939 PointsI don't get it if 00000011 = 3 then how does then why doesn't 00001000 = 4
because in the example 00000011 you said that since 1+2=3 cause the first one is 1 and the second one is 2 then how would you do this if the answer isn't 4 or am I having a problem with computer?
2 Answers
Jason Anders
Treehouse Moderator 145,860 PointsBinary is a Base-2. So, reading Right to Left, goes 1, 2, 4, 8, 16, 32, 64.
0000100 would equal 4 because third from right is 4 and '1' means that it is turned on.
0000011 would equal 3 because the '2' and '1' are turned on, thus 2+1 = 3.
Whichever bit is turned on
is added to what the number would be. A more complex example could be
0110010 would be 50. As the 32
, 16
, and 2
are turned on... 32+16+2 = 50.
Hope that helps clear it up a bit... (pun intended)
Keep Coding! :)
Saadia Fattah
1,939 Pointsoh... I get it HA HA! oh I'm laughing sooo hard right now
Saadia Fattah
1,939 PointsSaadia Fattah
1,939 PointsThanks for the info. Also where's the pun I can't find it?
Jason Anders
Treehouse Moderator 145,860 PointsJason Anders
Treehouse Moderator 145,860 PointsBinary "switches" are called "bits"... "hope that clears it up a bit" haha.