You will write the two conversions of this lesson as Python functions, without using Python's own bin or int(text, 2).
Your tasks.
to_denary, return the denary value of a binary string such as "01101001". Add the place values under the 1s.to_binary, return an 8-bit binary string for a number from 0 to 255. Divide by 2 again and again.largest to the denary value of the 8-bit string with every bit set to 1. Use to_denary.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…