0

the issue that I have: the loops forever (basic beginner mistake) and the output doesn't change, if I enter the same phrase twice. The code seem to have no issues, but once started, it runs until the memory ends.

enter image description here

asked Dec 12, 2022 at 4:47
2
  • 1
    Welcome to Stack Overflow. Please include your code as text and not as an image. Commented Dec 12, 2022 at 4:51
  • Please provide enough code so others can better understand or reproduce the problem. Commented Dec 12, 2022 at 9:58

1 Answer 1

1

You should know that := is the "walrus" operator and assigns a value to a variable and then returns it. So something like if command := 'start' is assigning the value 'start' to the variable command, and then checking if 'start' is a truthy value (which it is). What you probably meant to do is if command == 'start'

Also, if you want to ask the user for input until they issue the 'quit' command, you'll need to place the input() call inside the while loop

answered Dec 12, 2022 at 5:04
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.