Question: Task 3- Add 1000 numbers to a list Now instead of 5 numbers we're going to do the same thing with 100 random numbers
\
Task 3- Add 1000 numbers to a list Now instead of 5 numbers we're going to do the same thing with 100 random numbers in a list. We will add 100 random numbers to a list and then sort and print them out. First, we need to import the random module so we can generate random numbers import random Then we're going to initialize our variables so the system knows what we're using them for. list=[] index= 0 Then we'll add a loop that will loop through 100 times and append a random number to the list. Use the print(list) command to make sure your program has added the numbers to the list. print(" ") while index < 1000: list.append(random.randint(1,100)) index += 1 print(list) How could you change the program to use 1000 number instead of 100? Change the program to get 1000 random numbers. Run the program again. Could you do the same thing with 10000 numbers? How about 1,000,000? What is the limit for how many numbers you can use in your program?
Step by Step Solution
There are 3 Steps involved in it
To change the program to use 1000 numbers instead of 100 you need to modify the loop cond... View full answer
Get step-by-step solutions from verified subject matter experts
