Please explain this program to me. I don't understand the logic. I am a beginner, and I find it hard to grasp the logic behind these programs. It would be great if you could help me with this simple program
command = ""
started = False
stopped = False
while command = True:
command = input(">").lower()
if command == "start":
if started:
print("car is already started")
else:
started = True
print("car is ready to go")
elif command == "stop":
if stopped:
print("Car is already stopped")
else:
stopped = True
print("stop the car")
elif command == "help":
print(""" Start - to start the car
stop - to stop the car
quit - to quit
""")
elif command == "quit":
break
else:
print("I don't understand that")
Aucun commentaire:
Enregistrer un commentaire