Can you create a large list with random numbers?

Question

Create a list of 1000 random numbers

in progress 0
TheDataMonk 55 years 1 Answer 600 views Grand Master 0

Answer ( 1 )

  1. #creating a large list in python using random numbers
    #assuming random numbers to fall between 1 to 100 and integers

    import random #library to generate random numbers
    randlist = [] #creating an empty list

    for i in range(0, 1000): #for loop for generating random numbers and appending the list
    n = random.randint(1, 100)
    randlist.append(n)

    print(“the list generated with random numbers is n”, randlist)

Leave an answer

Browse
Browse