Question: The fractional part function divides the numerator by the denominator, and returns just the fractional part (a number between 0 and 1). Complete the body
The fractional part function divides the numerator by the denominator, and returns just the fractional part (a number between 0 and 1). Complete the body of the function so that it returns the right number. Note: Since division by 0 produces an error, if the denominator is 0, the function should return O instead of attempting the division. 1def fractional part (numerator, denominator): # Operate with numerator and denominator to 3 # keep just the fractional part of the quotient return Run print(fractional_part(5, 5)) # Should be o print (fractional part(5, 4)) # Should be 0.25 print(fractional part(5, 3)) # Should be 0.66... 9 print (fractional_part(5,2)) # Should be 0.5 10 print(fractional_part(5, 0)) # Should be 0 11 print (fractional part(0, 5)) # Should be Reset
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
