dimanche 19 juillet 2020

how to make an *if* statement loop?

i am new to python and i'm just trying simple exercises with if statements but i want my statement to loop, what i have is...

species = "cat"
if species == "cat":
    print("yep, it's a cat")
    species = "dog"
if species == "dog":
    print("and that's a dog")
    species = "horse"
if species == "horse":
    print("look at that horse over there")
    species = "cheetah"
if species == "cheetah":
    print("WHERE DID THE CHEETAH COME FROM?")

(yes it is a little silly) is there a way to continuously loop the statement and is there a way to limit the amount of times it loops? if there is a better way do what i am trying to do and if what what is it?

Aucun commentaire:

Enregistrer un commentaire