Question: ICS3U Python Programming Evaluation Question 3 File Name: ICS3UhexNibbles.py Write a function that converts any length binary number to its decimal equivalent. It must accept

ICS3U Python Programming Evaluation Question 3

File Name: ICS3UhexNibbles.py

Write a function that converts any length binary number to its decimal equivalent. It must accept a String value for the binary number and return the decimal equivalent

Use that function to write a program that accepts an entire string of binary nibbles entered from the keyboard and prints out the full hex equivalent. The nibbles in the input must be separated by spaces.

For Example:

  • An input of 0101 1101 produces an output of 5D
  • An input of 0000 1001 0001 1111 1100 produces an output of 091FC

Note: If you were planning on searching the internet on how to convert binary to decimal/hex numbers in python you might come across an interesting use of the int() function to accomplish this task. Or you might even find a built in function called hex(). You are not allowed to use those use cases in your solution. Impress me and do the conversion from scratch with a loop demonstrating what you know about lists/strings.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!