Question: For Python, In Chapter 4, (page 132 section 4.3.2) we developed an algorithm for converting from binary to decimal. In Chapter 4 (page 133 section
For Python,
In Chapter 4, (page 132 section 4.3.2) we developed an algorithm for converting from binary to decimal. In Chapter 4 (page 133 section 4.3.3) we developed an algorithm for converting from decimal to binary. Create main to ask the user if they want to enter 1 if they want to convert from binary to decimal and 2 if they want to convert from decimal to binary. If the user enters the number 1 the program should process the function reptoDecimal. If the user enters the number 2 the program should process the function decimalToRep
Define a function named repToDecimal that expect one argument, a String of bits. The function will convert the binary number the user entered to a decimal number and print both the binary and decimal number using this output The binary number binaryNumber, is, decimalNumber, in decimal.
Define a function named decimalToRep that expect one argument, an integer. The function will convert the decimal number the user entered to a binary number and print both the decimal and binary number using this output The decimal number decimalNumber, is, binaryNumber, in binary.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
