jeudi 21 janvier 2021

Easier Way to give randomized outputs?

So I want to randomize an output when a program gets ran, so this is what I have.

import random
chance = random.randint(1, 5)

if chance == 1:
    # 1st Random Output
elif chance == 2:
    # 2nd Random Output

And so on. Is there a simpler way to do this instead of having a bunch of if statements?




Aucun commentaire:

Enregistrer un commentaire