lundi 28 avril 2014

Array elements will not modify (Python 3.4)


Vote count:

0




Okay, no more questions after this:



import random

lotto = [0, 0, 0, 0, 0, 0, 0, 0]
index = 0

while index <= 6:
lotto[index] = random.randrange(1, 9)
index = index + 1
print("Lotto number",index,"is",lotto[index],"!")


I cannot seem to find what is up with why these array elements will not be modified. Index and the array are handled properly but the lotto[index] = random.randrange(1, 9) line seems to be useless. It doesn't change anything in the array at all. I know I'm missing something but I've been staring at this thing for a long time now and just cannot see what I'm screwing up. I've changed the elements and it outputs everything properly it just won't change the array elements. Halps?



asked 27 secs ago






Aucun commentaire:

Enregistrer un commentaire