vendredi 18 mars 2016

Random Number Generator Only Printing One Number

This is the code I have so far:

 from quick_pick import quick_pick
    def main():
     LIMIT = 67
     number = 9
     list_1 = []*number
     quick_pick(number, LIMIT, list_1)
     print (list_1)
     main()

import random
def quick_pick(n,limit,lottery):
    main_count = 0
    while main_count <n:
        lotto_numbers = random.randint(1, limit)
        if lotto_numbers not in lottery:
            lottery.append(lotto_numbers)
            main_count += 1
            return (lottery * n)

but when I run it I get this: [21]

Im not sure how to get all 9 numbers to show up in the list so I can print it. If someone could help it would be appreciated as this is for part of my assignment and I need it to do the rest of it.




Aucun commentaire:

Enregistrer un commentaire