116k views
0 votes
Plsss helppp me with thisss plsss

Plsss helppp me with thisss plsss-example-1
User Stokastic
by
7.7k points

1 Answer

4 votes

Answer:

Here is an example of what you're asking in Python.

import random

def buildList(x):

# Create an empty list to store the random integers

random_list = []

# Use a for loop to generate x random integers

for i in range(x):

# Append a random integer between 100 and 199 to the list

random_list.append(random.randint(100, 199))

return random_list

# Get the number of random integers from the user

x = int(input("Enter the number of random integers to generate: "))

# Call the buildList function to generate the random integers

random_integers = buildList(x)

# Print the list of random integers

print(random_integers)

Step-by-step explanation:

This script uses the 'random.randint()' function from the built-in 'random' module to generate a random integer between 100 and 199, and then it saves the generated random integers in a list. The script also prompts the user for the number of random integers to generate and calls the buildList function with the user input. Finally, it prints the list of random integers.

User Elgayed
by
7.4k points