Davido
Davido

Reputation: 1

stuck running a while loop (beginner)

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

Upvotes: 0

Views: 31

Answers (1)

David
David

Reputation: 21

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

Upvotes: 1

Related Questions