dimanche 29 juillet 2018

Skipping lines of code in Python?

So as my first project on python I am trying to make a dichotomous key like program where it guesses what animal you are thinking of after asking questions, I'm really new to this so try to explain it kind of simple :). Also sorry if this question has been asked somewhere else, I didn't really know how to ask it.

think=input ("Think of an animal. Type ready when you want to begin")
think=think
#FUR
if think=="READY" :
   fur=input ("Does it have fur?") 
else :
   print ("I'll be waiting")
if fur=="YES" :
   legs=input ("Does it walk on four legs?") :
elif fur=="NO" :
   reptile=input ("Is it a reptile?")
#REPTILE
if reptile=="YES" :
   shell=input ("Does it have a shell?") 
if reptile=="NO" :
   fly=input ("Can it fly?") 
#LEGS
if legs=="YES" :
   pet=input ("Do people own it as a pet?")
if legs=="NO" :
   marsupial=input("Is it a marsupial?")

I can't get it to skip to "Do people own it as a pet" if you answer yes on legs. also, the "I'll be waiting" (else) doesn't work. Oh, and this is python 3.x btw.

Edited for formatting

Edit 2: Got rid of the parentheses in my comparisons :)

Aucun commentaire:

Enregistrer un commentaire