invalid syntax elif python error -
i'm getting elif error on elif myanswer == "1": line say's syntax error points end of elif. help, appreciate it.
#if statements make first scenario run print(place1) while not gameover: print(option1) myanswer = getanswer() elif myanswer == "1": print("nothing happens, dog waits") elif myanswer == "2": print("you nobely decide fight dog.") #if statements make second scenario run print(place2) while not (belly , head , tail): print(option2) myanswer = getanswer(["1","2","3","4"]) if myanswer == "1": print("you scratched dog on head claws") head = true elif myanswer == "2": print("you bite dog's soft belly") belly = true elif myanswer =="3": print("you cut off dog's tail razor sharp teeth") tail = true elif myanswer =="4": print("you retreat steps away dog") print(situation1) #return main loop break # leave dog loop break # leave dog loop , leave main loop else: # dog loop leaved correctly print("the dog bleeds head, tail , belly , runs away." "you victorious! congratulation, have won game") gameover = true #leave dog loop correctly elif myanswer == "3": print("you run away, dog faster , eats whole!." "the dog eat you. game over") gameover = true print("try again , playing")
elif
can used after , if
statement. replace first elif
elif myanswer == "1"
with
if myanswer == "1":
Comments
Post a Comment