generate functionMon, 06 Mar 2023

enter a floating point number n. Output ten numbers the total sum of which is equal to n. In the ten numbers displayed, the numbers do not go in a row. The output ten digits have exactly twelve digits after the decimal point. the numbers are positive.

def sum_to_n(n): total = 0 for i in range(10): x = round(n/10, 12) total += x return total sum_to_n(1.123456789)

Questions about programming?Chat with your personal AI assistant