Computer Science, asked by meseneobrightmichael, 2 months ago

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 0 instead of attempting the division.

Answers

Answered by MiscreantAngel
1

Answer:

Water moves across cell membranes by diffusion, in a process known as osmosis. Osmosis refers specifically to the movement of water across a semipermeable membrane, with the solvent (water, for example) moving from an area of low solute (dissolved material) concentration to an area of high solute concentration.

 \\  \\  \\

Answered by davidfrimpong964
0

Answer:

def fractional_part(numerator, denominator):

# Operate with numerator and denominator to

# keep just the fractional part of the quotient

if denominator > 0:

 number = (numerator % denominator) / denominator

if denominator == 0:

 return 0

return number

return 0

print(fractional_part(5, 5)) # Should be 0

print(fractional_part(5, 4)) # Should be 0.25

print(fractional_part(5, 3)) # Should be 0.66...

print(fractional_part(5, 2)) # Should be 0.5

print(fractional_part(5, 0)) # Should be 0

print(fractional_part(0, 5)) # Should be 0

Explanation:

Similar questions