mardi 12 juin 2018

if statement to print a statement based on the output of a random choice function with a string array

I am not able to refer to an output of a random choice function using an array.

import random
dice = ["•", "• •", "• • •", "• • • •", "• • • • •", "• • • • • •"] #strings of dots

print(random.choice(dice))

if dice == dice([5]): #Does not work, not able to refer to the six dot string

     print("You are lucky.")

elif dice:
     print("You are not lucky.")




Aucun commentaire:

Enregistrer un commentaire