Wpis z mikrobloga

#programowanie #python #naukaprogramowania

command =""
started=False
while True:
command = input("> ").lower()
if command == "start":
if started:
print("Car already started.")
else:
started=True
print("Car started...")
elif command=="stop":
if not started:
print("Car already stopped.")
else:
started:False
print("Car stopped.")
elif command=="help":
print("""
start - to start the car
stop - to stop the car
quit - to quit
""")
elif command=="quit":
break
else: print("Sorry, I don't get it")

start potem stop, wszystko działa. natomiast jak wpiszę znowu start wyskakuje mi, że samochód już jest uruchomiony, mimo, że przed chwilą było wpisane stop.
  • 4
  • Odpowiedz
  • Otrzymuj powiadomienia
    o nowych komentarzach