Question: 2. The hexadecimal number system is a base-16 system, that is, it makes use of 16 symbols: 0, 1, 2, 3, 4, 5, 6,7, 8,

2. The hexadecimal number system is a base-16 system, that is, it makes use of 16 symbols: 0, 1, 2, 3, 4, 5, 6,7, 8, 9, A, B, C, D, E, F. The symbols 0 to 9 are equivalent in hexadecimal and decimal, while A in hexadecimal is equal to 10 in decimal, B in hexadecimal is equal to 11 in decimal, and so on. To convert from hexadecimal to decimal we simply multiply by powers of 16. For example, 98A in hexadecimal can be converted to decimal as folllows: 9 x 162 + 8 161 + 10 160-2442,o. Write a recunsive Python function, in a file called hex_to_dec.py, to convert a hexadecimal number (passed to the function as a string) to its decimal equiva- lent. Include a main function to test your function using a user-input hexadec- imal value
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
