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.

from decimal import Decimal def func(n): a = Decimal(str(n)) b = Decimal(str(n)) / 10 c = Decimal(str(n)) / 100 d = Decimal(str(n)) / 1000 e = Decimal(str(n)) / 10000 f = Decimal(str(n)) / 100000 g = Decimal(str(n)) / 1000000 h = Decimal(str(n)) / 10000000 i = Decimal(str(n)) / 100000000 j = Decimal(str(n)) / 1000000000 return [a, b, c, d, e, f, g, h, i, j] func(4)

Questions about programming?Chat with your personal AI assistant