vendredi 15 mai 2015

Generate random numbers in range without repetition

I'm creating a trivia game and need to call 10 questions (functions) in a random order. I could simply generate a random integer 1-10 and use if statements to call each function, but I need to make sure that no questions are called more than once, so I need to generate random numbers without repetition.

def Trivia_Snap():
    question_1()
    question_2()
    question_3()
    question_4()
    question_5()
    question_6()
    question_7()
    question_8()
    question_9()
    question_10()




Aucun commentaire:

Enregistrer un commentaire