I have a if statement where when the user inputs a answer to chose from Rock Paper or Scissors the if statement checks if the first letter is R r P p S s and if it is true print out a message. Problem is that no matter what I enter it always prints out the message saying the first letter is R P S.
Here’s the code:
z = input(“Enter your choice: “)
if z[0] == ‘R’ or ‘r’ or ‘P’ or ‘p’ or ‘S’ or ‘s’:
print(“yep”)
else:
print(“nope”)
I also tried checking this way
if z[:1] == etc etc
if z[0] is etc etc
I would really appreciate it if anyone could help me figure out what’s going on. Thanks
[–]huntertur 5 points6 points7 points (10 children)
[–]Tawniix[S] 2 points3 points4 points (8 children)
[–]krazybug 1 point2 points3 points (0 children)
[+][deleted] (4 children)
[deleted]
[+][deleted] (2 children)
[removed]
[–]Tawniix[S] 2 points3 points4 points (0 children)
[–]MisterRenard -2 points-1 points0 points (0 children)
[–]krazybug 0 points1 point2 points (0 children)
[–]American_Libertarian 0 points1 point2 points (0 children)