Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python (it has to be GUI ) Conversions between Hexadecimal numbers and decimal numbers. write a program in python that should ask (prompt) the user
Python (it has to be GUI)
Conversions between Hexadecimal numbers and decimal numbers. write a program in python that should ask (prompt) the user for what to convert 1. Hex to decimal 2. Decimal to hex as a string validate. Then depend of the user's pick if 1 and it's a valid hax number then the program should read that hexadecimal number and convert it to decimal and print it. If the input contains characters that are not hexadecimal numbers, then an error message is printed. format given below Conversions Between Hexadecimal Numbers and Decimal Numbers Given a hexadecimal number hnhn-1hn-2... h2h1ho, the equivalent decimal value is hn x 16" + hn-1 X 16-1 + hn-2 X 16-2 + ... + h x 16 + h1 x 16 + ho x 16 The following are examples of converting hexadecimal numbers to decimals: Hexadecimal Conversion Formula Decimal 7F 7 x 161 +15 x 16 127 FFFF 431 15 x 163 + 15 x 162 + 15 x 161 + 15 x 16 4 x 162 + 3 x 161 + 1 x 16 65535 1073 To convert a decimal number d to a hexadecimal number is to find the hexadecimal digits hn, hn-1, hn-2, h2, h, and ho such that d = hn x 16" + hn-1 X 16-1 + hn-2 X 16"-2 + ... + h x 16 + h x 16 + ho x 16 These numbers can be found by successively dividing d by 16 until the quotient is 0. The remainders are ho, h1, h2r, h-2 hn-1, and hn.
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