Write a program in Python that takes the output above in BIN

Write a program in Python that takes the output above in BINARY and converts it to DECIMAL. Please help

Solution

Answer:

binary = raw_input ( \' enter a number \' )

decimal = 0

for digit in binary :

decimal = decimal * 2 + int (digit)

print decimal

Write a program in Python that takes the output above in BINARY and converts it to DECIMAL. Please helpSolutionAnswer: binary = raw_input ( \' enter a number \'

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site