Did You Know?Everything that is stored on a computer is stored as binary code. Binary code is made of bits (0 or 1). We often use Bytes to store data. A Byte is made of eight bits and can be used to store any whole number between 0 to 255. Check it yourself, click on the binary digits to create your own binary number:
128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255
The purpose of this challenge is to write a Python script to convert a Binary number into denary and vice versa. To do so we will use the concept of binary left and right shifts as explained below.
Binary Left Shift
A binary left shift is used to multiply a binary number by two. It consists of shifting all the binary digit to the left by 1 digit and adding an extra digit at the end with a value of 0.
Binary Right Shift
A binary right shift is used to divide a binary number by two. It consists of shifting all the binary digit to the right by 1 digit and adding an extra digit at the beginning (to the left) with a value of 0.
Solution...The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area