dimanche 19 juillet 2020

Randomly choosing between two options

i am very new to python and am trying to learn the language better. i am trying to create something very simple, i am playing around with if statements, i am trying to choose a random option and based on what is picked have a different response. what i have looks like this...

species = "cat" or "dog"
if species == "cat":
    print("yep, it's a cat")
else:
    print("nope, it's a dog")

but the outcome is always cat. how do i make it randomly choose?




Aucun commentaire:

Enregistrer un commentaire