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 ten_numbers(n): import random list_10 = [] n1 = round(n/10 - random.randint(0, 10) / 1000, 12) print(n1) n2 = round(n1 - random.randint(0, 10) / 1000, 12) print(n2) n3 = round(n2 - random.randint(0, 10) / 1000, 12) print(n3) n4 = round(n3 - random.randint(0, 10) / 1000, 12) print(n4) n5 = round(n4 - random.randint(0, 10) / 1000, 12) print(n5) n6 = round(n5 - random.randint(0, 10) / 1000, 12) print(n6) n7 = round(n6 - random.randint(0, 10) / 1000, 12) print(n7) n8 = round(n7 - random.

Questions about programming?Chat with your personal AI assistant