0
Hi, hope you're doing good.Could someone please tell me why does the while loop not stop when I type in rock, paper or scissors?
Here's the code: while True: choices = ["rock", "paper", "scissors"] user_choice = input("What is your choice, rock,paper or scissors: ") if not user_choice == choices[0] or choices[1] or choices[2]: print("Please enter rock, paper or scissors! ")
6 Respuestas
+ 4
This should be the code:
while True:
choices = ["rock", "paper", "scissors"]
user_choice = input("What is your choice, rock,paper or scissors: ")
if user_choice not in choices:
print("Please enter rock, paper or scissors! ")
+ 1
Ohh yesss thank you so much
+ 1
Yes Lochard thank you for adding that but I already knew it I just wanted to know about the specific part I asked for as Yusuf said. Thanks to you guys y'all are awesome
0
The loop still doesn't break.
Maybe you want somethin like this?
https://code.sololearn.com/cvqS2ZFQ0i9n/?ref=app
0
Lochard he never asked for it to break, he asked for the loop to work. it was best if he figured the rest out himself
0
He asked why the while loop does not stop when he types in one of the choices in the title. So I guess that's what he wants.
You are right about letting him figure out though. I guess I just wanted to practice coding.