I created a random lottery number generator for COP1000 that passes a random number 0-9 to an array of 7 integers. However, when I print the array, I get the same output 7 times. It may be a problem with one of the loops but I am unsure of where it is coming from. Any help would be greatly appreciated.
Here is the code:
import random
print("Seven lucky numbers; are you ready?")
numbers = [0,0,0,0,0,0,0]
index = 0
while index<len(numbers):
numbers[index] = random.randint(0,9)
index = index + 1
for n in numbers:
print("\nYour random lottery number is:")
print(numbers[0],numbers[1],numbers[2],numbers[3],numbers[4],numbers[5],numbers[6])