I keep getting a "illegal target for annotation" & "unexpected token else" WHY????? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I keep getting a "illegal target for annotation" & "unexpected token else" WHY?????

command = "" started = False while True: command=input("> ").lower() if command=="start": if started: print("Car is already started") else: started = True print("The car is started...") elif command=="stop": if not started: print("The car is already stopped!") #this line below is where my error is else: started = False print("The car has stopped.") elif command=="help": print(""" start - to start the car stop - to stop the car quit - to quit """) elif command=="quit": break else: print ("???")

20th Jun 2019, 5:10 PM
Kirsten Leonard
Kirsten Leonard - avatar
4 Answers
0
The else immediately below where your comment is needs to be de-intented so that it is in line with the if two lines above.
20th Jun 2019, 5:17 PM
Russ
Russ - avatar
+ 1
Thanks Russ its runnin' smoothly!!!
20th Jun 2019, 5:19 PM
Kirsten Leonard
Kirsten Leonard - avatar
20th Jun 2019, 5:12 PM
Kirsten Leonard
Kirsten Leonard - avatar
0
Kirsten Leonard Glad to hear!
20th Jun 2019, 5:22 PM
Russ
Russ - avatar