Here is my current code-
import random
for x in range(4):
randomInt = random.randint(1,9)
randomList = []
randomList.append(ranInt)
print ranList
What I'm trying to do is have the generator generate 4 numbers between 1 and 9 and then print all those variables to the same list. Right now what this code returns is 4 random numbers, and they are formatted in brackets on individual lines. How do I fix this so they are all in one list?
Aucun commentaire:
Enregistrer un commentaire