0

I have a very simple program, where it just check the user's input and ask eventually for a correct input.

player1 = input('Scissors (S), Rock (R), Paper (P) ?:')

while player1 is not 'S' or 'R' or 'P':
 player1 = input('Invalid Input, please choose correctly! /n Scissors (S), Rock (R), Paper (P) ?:')

If players1 is 'S' or 'R' or 'P' then it still asks for a correct input. I am not sure what I am missing. Excuse me if this might sound very trivial.

Edit:

writing it this way still does not recognize a correct input

   while player1 is not 'S' or player1 is not 'R' or player1 is not 'P':
   while player1 in {'S', 'R', 'P'}:

this way is just recognize 'S' as correct, if a type 'R' is still wrong

while player1 != 'S' and 'R' and 'P':

Correct:

while player1 != 'S' and player1 != 'R' and player1 != 'P':
xava
  • 293
  • 1
  • 2
  • 16

0 Answers0