Question: Python Number Converter (program) which will convert a decimalnumber (base 10) to its equivalent in Hexadecimal (base 16) Octal (base 8) Binary (base 2)
Python “Number Converter” (program) which will convert a decimalnumber (base 10) to its equivalent in –
- Hexadecimal (base 16)
- Octal (base 8)
- Binary (base 2) values.
Sample Test Runs
Number Converter -> convert a number (between 0 and 255)from
Enter 1 -- Decimal to Hexadecimal
Enter 2 -- Decimal to Octal
Enter 3 -- Decimal to Binary (Between 0 and 64)
Enter X -- Exit
Enter your choice: 5
Invalid choice
Number Converter -> convert a number (between 0 and 255)from
Enter 1 -- Decimal to Hexadecimal
Enter 2 -- Decimal to Octal
Enter 3 -- Decimal to Binary (Between 0 and 64)
Enter X -- Exit
Enter your choice: a
Invalid choice
Number Converter -> convert a number (between 0 and 255)from
Enter 1 -- Decimal to Hexadecimal
Enter 2 -- Decimal to Octal
Enter 3 -- Decimal to Binary (Between 0 and 64)
Enter X -- Exit
Enter your choice: 1
Enter a decimal number: 300
Invalid input value. Try again
Step by Step Solution
3.42 Rating (155 Votes )
There are 3 Steps involved in it
Intro In Python you can convert numbers from one type to another using builtin functions Here are some examples int This function converts a number or ... View full answer
Get step-by-step solutions from verified subject matter experts
