generate functionTue, 07 Mar 2023

A fractional number n is entered from the keyboard. Output ten numbers the sum of all ten numbers displayed is n.

def fraction(n): total = 0 for i in range(1, 11): total += (i / 10) print(total) assert total == n fraction(2)

Questions about programming?Chat with your personal AI assistant