dimanche 30 septembre 2018

Randomly selecting items froma list without repeating Python

I was given this problem: Program that randomly shows 53 cards one by one every 5 seconds or so without repeating them.

My code right now looks extremly basic as Im still trying to figure out how to make it work. I have managed to randomly print the items from the list without repeating but when it runs out of options i get an error. Here's a part of my code:

let = ['CARD 1','CARD2','CARD 3']#Theres only 3 cards until i figure how to do it
if var=='iniciar' or 'INICIAR':
  while True:
    random.choice(let)
    while len(let):
    print let.pop()
    import time
    time.sleep(.5)

Can any of you figure out how to do it or have an example I can use?




Aucun commentaire:

Enregistrer un commentaire