This assignment involves the use of a dictionary, functions, and exception handling. Write a program that converts a number input in hexadecimal into binary. The program should use a Python dictionary to hold the conversion pairs from hexadecimal to binary. For your reference, here is a table showing the conversions from hexadecimal to binary .
This assignment involves the use of a dictionary, functions, and exception handling. Write a program that converts a number input in hexadecimal into binary. The program should use a Python dictionary to hold the conversion pairs from hexadecimal to binary. For your reference, here is a table showing the conversions from hexadecimal to binary .
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
100%
please see attatched image, thank you

Transcribed Image Text:This assignment involves the use of a dictionary, functions, and
Hexadecimal Binary
'O'
Hexadecimal Binary
"0000'
'8'
'1000'
exception handling.
'1'
"0001'
'9'
'1001'
Write a program that converts a number input in hexadecimal
'2'
'0010'
'A'
'1010'
into binary. The program should use a Python dictionary to
hold the conversion pairs from hexadecimal to binary. For your
reference, here is a table showing the conversions from
hexadecimal to binary .
'3'
'0011'
'B'
'1011'
'4"
'0100'
'C'
'1100'
'5'
'0101'
'D'
'1101'
'6'
'0110'
'E'
'1110'
'7'
'0111'
'F'
'1111'
You should have two functions .. main() and convert(). The main() function should simply ask the user to enter a
hexadecimal number, then pass the hex number to the convert() function. The convert() function should accept the hex
number, then use the dictionary to determine the binary equivalent. The complete binary number should be returned
to main(). The main() function should then print the binary number. Note that the hex number may have only one digit
or it may have multiple digits. See the examples below.
RESTART: C:\Users\dbatts00
Enter a hexadecimal number: B
The binary equivalent is 1011
RESTART: C:\Users\dbattso0
Enter a hexadecimal number: 2A
The binary equivalent is 00101010
>>>
RESTART: C:\Users\dbatts0d
Enter a hexadecimal number: B6F
The binary equivalent is 101101101111
Make sure to check for a KeyError. (Remember that hexadecimal numbers must be 0 through F. Lowercase letters
should not be recognized as a valid hexadecimal number. See below .
Enter a hexadecimal number: b6f
The binary equivalent is not found. Invalid hexadecimal number.
Make sure to include header and step comments in your program.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY