This community-built FAQ covers the “Decimal to Binary Conversion” exercise from the lesson “Binary Numbering System”.
Paths and Courses
This exercise can be found in the following Codecademy content:
(Beta) CS104: Computer Architecture
FAQs on the exercise Decimal to Binary Conversion
There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
You can also find further discussion and get answers to your questions over in #get-help.
Agree with a comment or answer? Like () to up-vote the contribution!
Need broader help or resources? Head to #get-help and #community:tips-and-resources. If you are wanting feedback or inspiration for a project, check out #project.
Looking for motivation to keep learning? Join our wider discussions in #community
Learn more about how to use this guide.
Found a bug? Report it online, or post in #community:Codecademy-Bug-Reporting
Have a question about your account or billing? Reach out to our customer support team!
None of the above? Find out where to ask other questions here!
I am so confused about what to do for number 3 here
agreed. the hint doesn’t help at all.
Exactly. The lesson might be outdated I guess. It also doesn’t make sense why they gave specific remainders and results but they don’t indicate anything particular about the answer.
the exercise is simple but I cant get the demo to work.
first, some weird things: why do we go from ‘first result’ to ‘third result’ with no second result? then sixth?
second, it’s not clear if the python is v2 or v3 and the 1/2 vs 1//2 behavior changed, so that should be made clear
when i finally looked at the solution: it was not clear to me to just type in the answer, i thought we were writing code to compute it (i was starting to think about pre-pending str( remainders) and making some loop to automate it)
At the top of the Python code,
That will tell you what version the editor has running behind it.
There are other tell-tale signs:
print "Hello World!"
will raise an error in Python 3, as will,
x = raw_input("")
or try dividing two integers.
42 / 7
It will give
6 in Python 2 and
6.0 in Python 3.
If I’m not mistaken, floor division used to always return an integer, whereas in Python 3, it can be a float or an integer.
you are correct in all those ways, however that is not what I was talking about.
the code prompt is some .py file, and until you test it, it’s not clear which version of python is being used in the terminal
moreover, the exercise wasn’t to actually compute the numbers, it was to just type in the values which the user is free to work out with pen and pencil (since it’s just how to write an integer in binary, no signs or decimals so far)
Okay, please drop us a link to the exercise and we’ll take a closer look.