87.5k views
0 votes
Write a program that will generate three randomly sized sets of random numbers using 6 constant variables. 3 for the maximum values in the sets (values should be 25, 50, and 250) and 3 for the maximum number of values to be displayed in the sets (for each number, the values should be 5, 6, 7)

User Sherrell
by
7.7k points

1 Answer

4 votes

Final answer:

To generate three randomly sized sets of random numbers using 6 constant variables, you can use a programming language such as Python.

Step-by-step explanation:

To generate three randomly sized sets of random numbers using 6 constant variables, you can use a programming language such as Python. Here is an example program:

import random

max_values = [25, 50, 250]
max_num_values = [5, 6, 7]

for i in range(3):
size = random.choice(max_num_values)
values = [random.randint(0, max_values[i]) for _ in range(size)]
print('Set', i+1, ':', values)

In this program, the random.choice function is used to randomly select a value from the max_num_values list, and then the random.randint function is used to generate random numbers within the range specified by the corresponding max_values element. The program prints each set of random numbers.

User Origamic
by
8.2k points