0

I am trying to create a simple while loop that will run the commands start, stop, quit, and help. Start, stop, and help will just display some printed text. After they are run, I want it to keep going on to another command. However, on quit I want the whole program to stop.

input_command = input("> ").lower()

while input_command != "quit":
    print(input_command)
    if input_command == "start":
        print("The car is ready! VROOM VROOM!")
        print(input_command)
    elif input_command == "stop":
        print("Car stopped.")
    elif input_command == "help":
        print("""
        start - starts the car
        stop - stops the car
        quit - exits the program
        """)
else:
    print("Sorry, I don't understand that...")
2
  • 1
    You never asign new value to input_command Commented Oct 11, 2019 at 14:43
  • You will have to change input_command somewhere in the loop. Commented Oct 11, 2019 at 14:44

1 Answer 1

3

You never reassign input command so it only ever takes input once,

input_command = ''

while input_command != "quit":
     input_command = input("> ").lower()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.