-1

I'm learning python and I tried to make rock paper scissors game. And I'm here stuck on one problem. I have no idea how to fix it. So the problem is when I type in "paper" and "ranval" variable choices 2 (scissors) I still win. Thank you a lot for your time. There is the code:

import random
while True: # 0 rock, 1 paper, 2 scissors
    while True:
        rps = [0, 1, 2]
        ranval = random.choice(rps)
        choice = str(input("(r)ock, (p)aper or (s)cissors?"))

    if choice.lower() == "r" or "rock":

        if ranval == 0:
            print("TIE!", ranval)
            break
        elif ranval == 1:
            print("YOU LOST!", ranval)
            break
        elif ranval == 2:
            print("YOU WON!", ranval)
            break

    if choice.lower() == "p" or "paper":

        if ranval == 0:
            print("YOU WON!", ranval)
            break
        elif ranval == 1:
            print("TIE!", ranval)
            break
        elif ranval == 2:
            print("YOU LOST!", ranval)
            break

    if choice.lower() == "s" or "scissors":
        if ranval == 0:
            print("YOU LOST!", ranval)
            break
        elif ranval == 1:
            print("YOU WON!", ranval)
            break
        elif ranval == 2:
            print("TIE!", ranval)
            break

    if choice.lower() == "e" or "exit":
        exit()
petezurich
  • 9,280
  • 9
  • 43
  • 57
Feal1337
  • 1
  • 1

1 Answers1

2

if choice.lower() == "r" or == "rock":

if choice.lower() == "r" or choice.lower() == "rock":

are different.

go make your if statements all look like that

if choice.lower() == "r" or choice.lower() == "rock":

chitown88
  • 27,527
  • 4
  • 30
  • 59