Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions Icon

Related questions

Question
100%

please see attatched image, thank you

[画像: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. ]
expand button
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
Check Mark
Knowledge Booster
Background pattern image
Similar questions
    Recommended textbooks for you
    Text book image
    Computer Networking: A Top-Down Approach (7th Edi...
    Computer Engineering
    ISBN:9780133594140
    Author:James Kurose, Keith Ross
    Publisher:PEARSON
    Text book image
    Computer Organization and Design MIPS Edition, Fi...
    Computer Engineering
    ISBN:9780124077263
    Author:David A. Patterson, John L. Hennessy
    Publisher:Elsevier Science
    Text book image
    Network+ Guide to Networks (MindTap Course List)
    Computer Engineering
    ISBN:9781337569330
    Author:Jill West, Tamara Dean, Jean Andrews
    Publisher:Cengage Learning
    Text book image
    Concepts of Database Management
    Computer Engineering
    ISBN:9781337093422
    Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
    Publisher:Cengage Learning
    Text book image
    Prelude to Programming
    Computer Engineering
    ISBN:9780133750423
    Author:VENIT, Stewart
    Publisher:Pearson Education
    Text book image
    Sc Business Data Communications and Networking, T...
    Computer Engineering
    ISBN:9781119368830
    Author:FITZGERALD
    Publisher:WILEY