I'm new to programming. I'm learning the walrus operator. I want the while loop end/stop when someone type quit or finish. Only quit works. when someone type "finish", it produces an output instead of existing the loop. Is there a way to end the while loop with both quit and finish?
When I print the variable foods, it gives the values True instead of the inputs(rice and wings). Is there a way for the walrus operator to show the actual input(rice, wings)
This is my code.
foods =list()
while food := input("what food do u like?: ") !="quit" != "finish":
foods.append(food)
what food do u like?: rice
what food do u like?: wings
what food do u like?: finish
what food do u like?: quit
foods
[True, True, True]
I tried watching several youtube videos and searching online but I didn't find the answer.
!=like that, doesn't work either way.