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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started