mardi 19 mars 2019

Is it possible to use an if statement with a random choice from an array?

I dont know if this is possible and any help would be appreciated. I want to use an if statement but i want it to be random i find this hard to explain so here is what i mean. The line draws every time, when i want it to be random. So if cat is randomly chose it would create that line. Any way to fix this if possible?

code:

easy = ["cat","bed","sofa","cow","sheep"]
random.choice(easy)
if random.choice(easy) == "cat":
canvas.create_line(200, 150, 200, 250,fill="white")




Aucun commentaire:

Enregistrer un commentaire