lundi 9 novembre 2020

creating a python lottery program


import random

def randomNum():
    for iteration, num in enumerate(range(4)):
        first = random.randint(1,10)
        second = random.randint(1,10)
        third = random.randint(1,10)
        fourth = random.randint(1,10)
    print('Lotto number 1', first)
    print('Lotto number 2', second)
    print('Lotto number 3', third)
    print('Lotto number 4', fourth)
    print('the number of tries', iteration)
print(randomNum())

I'm new to python and I was given some instructions to create a lottery program but I don't even know where to start with this. the instructions are to 1-create a program that picks for random numbers. 2-Make it so the program does not pick the same number twice(the one that confused me). 3- count the number of retries to get four different numbers. 4- make it so you can keep playing it. Included a picture of the results

enter image description here




Aucun commentaire:

Enregistrer un commentaire