I'm new to coding so I've been doing exercises. This one is about a car that the user commands to start and stop. My question is that why did the given solution include the first line in the following code?:
command = ""
started = False
while True:
command = input("> ").lower()
if command == "start":
if started:
print("The car has already started")
else:
started = True
print("The car started")
elif command == "stop":
if not started:
print("The car has already stopped")
else:
started = False
print("The car stopped")
elif command == "quit":
print("Goodbye!")
break
elif command == "help":
print("""start - start the car
stop - stop the car
quit- quit the game""")
else:
print("Sorry, I don't understand")
I tried removing the first line and running the code and as far as I could tell it worked perfectly. If I'm missing something obvious I apologize!