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. All ten numbers displayed are positive. Numbers must have twelve significant decimal places. The first two digits after the decimal point in the printed numbers can be equal to 0. The rest of the digits in the ten output numbers go without repetition.

import random def print_ten(x): r = random.Random() r.seed(x * x * x * x * x) random_nums = [] for i in range(10): random_nums.append(r.random()) print(random_nums) print_ten(10)

Questions about programming?Chat with your personal AI assistant