Question: ( Please answer Question # 3 ) 1 . ) Convert the following numbers from decimal to binary: 1 , 2 , 4 , 8

(Please answer Question #3)1.) Convert the following numbers from decimal to binary: 1,2,4,8,16,32,64,128
a.) Use the following code to output all of the answers at once: print(bin(1)),(bin(2)),(bin(4)),(bin(8)),(bin(16)),(bin(32)),(bin(64)),(bin(128))
b.) When you see the output , note that 0b is in front of each number. That serves to indicate that the output number is in binary.
2.) Convert the following numbers from decimal to octal: 8,64,512,4096,32768,262144,209715.
a.) hint: use the oct() function
b.) note that each octal output has 0o in front of it.
3.) Based on the pattern in Questions 1 and 2,do a third set of conversion for hexadecimal. What will those conversions be ? Write the code and convert them.
a.) use the hex() function
b.)note that hexadecimal outputs have 0x in front of them

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!