my program is to create a randomized list of 1-10 for a range of 1000, each number has to be randomized through 1-10 then once that is done. I need to identify how many 1s, 2s,3s, and 4,s, etc there are in the 1000 randomized numbers.
import random
#Printing a random list of 1 through 10
#loop to loop 1000 times
for i in range(1000):
#lisitng random numbers 1 through 10 inclusive
l1 = random.randint(1, 10)
l2 = random.randint(1, 10)
l3 = random.randint(1, 10)
l4 = random.randint(1, 10)
l5 = random.randint(1, 10)
l6 = random.randint(1, 10)
l7 = random.randint(1, 10)
l8 = random.randint(1, 10)
l9 = random.randint(1, 10)
l10 = random.randint(1, 10)
#printing the numbers in a list form
print(l1,l2,l3,l4,l5,l6,l7,l8,l9,l10)
#A function to identify how many X are there in each number
If you need more information on this please tell me in the comments.
Aucun commentaire:
Enregistrer un commentaire