generate functionMon, 06 Mar 2023

enter a floating point number n. Output ten numbers the total sum of which is equal to n.

def f(n): if n == 0: return [] x = random.random() return [x] + f(n-x)

Questions about programming?Chat with your personal AI assistant