Question: 2. (10) In this problem you define a function called get_fraction_bits which will take as input two integers a and b where a is non-negative

2. (10) In this problem you define a function called get_fraction_bits which will take as input two integers a and b where a is non-negative and b, as well as a positive integer num_digits. Assume that a is less than b. You function will return a list of the first num_digits in the binary decimal representation of the fraction b . For example if the input is a=1, b=4, num_digits=5 the the output would be [0, 1, 0, 0, 0] since 1 these are the first five binary decimal digits for 1/4.

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!