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.
-
1Welcome to Stack Overflow. Please include your code as text and not as an image.ewokx– ewokx2022年12月12日 04:51:19 +00:00Commented Dec 12, 2022 at 4:51
-
Please provide enough code so others can better understand or reproduce the problem.Community– Community Bot2022年12月12日 09:58:32 +00:00Commented Dec 12, 2022 at 9:58
1 Answer 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