اذهب إلى المحتوى

Geographic Information

الأعضاء
  • المساهمات

    1
  • تاريخ الانضمام

  • تاريخ آخر زيارة

إنجازات Geographic Information

عضو مبتدئ

عضو مبتدئ (1/3)

1

السمعة بالموقع

  1. Question 9 Fill in the blanks to complete the function. 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. def fractional_part(numerator, denominator): # Operate with numerator and denominator to # keep just the fractional part of the quotient if denominator == 0 or ___ or ___: part = 0 else: part = (__%__)/__ return part print(fractional_part(5, 5)) # Should print 0 print(fractional_part(5, 4)) # Should print 0.25 print(fractional_part(5, 3)) # Should print 0.66... print(fractional_part(5, 2)) # Should print 0.5 print(fractional_part(5, 0)) # Should print 0 print(fractional_part(0, 5)) # Should print 0
×
×
  • أضف...