0

I've been trying to code a rock paper scissors game, but my if statement keeps on skipping to my else statement, and when I common it out, it just doesn't print anything. Help! here is the code:

rock = '''
    _______
---'   ____)
      (_____)
      (____)
---.__(___)
'''

paper = '''
    _______
---'   ____)____
          ______)
          _______)
         _______)
---.__________)
'''

scissors = '''
    _______
---'   ____)____
          ______)
       __________)
      (____)
---.__(___)
'''

#Write your code below this line 
import random
person = input("What do you choose. Type 0 for Rock, 1 for Paper, and 2 for Scissors ")

computer = random.randint(0, 2)


if person == 0 and computer == 1:
  print(f"You choose: /n {rock} /n Computer choose: /n {paper} /n You win!")
elif person == 0 and computer == 2:
  print("You choose: /n {rock} /n Computer choose: /n {scissors} /n You lose ")
elif person == 1 and computer == 0:
  print(f"You choose /n {paper} /n Computer choose: /n {rock} /n You win!")
elif person == 1 and computer == 2:
  print(f"You choose: /n {paper} /n Computer choose: /n {scissors} /n You lose ")
elif person == 2 and computer == 0:
  print(f"You choose: /n {scissors} /n Computer choose /n {rock} /n You lose ")
elif person == 2 and computer == 1:
    print(f"You choose /n {scissors} /n Computer choose: /n {paper} /n You win!")
else:
    print("I'm sorry, that is not an available input. Please try again")`
 Thanks. any help appreciated.

P.S. I am currently learning python, so I don't know everything. Please only use beginner stuff when trying to answer

I'm expecting, when you enter in a number between 0 and 2, the computer then generates a random number between 0 and 2, and then prints what you chose, prints what the computer 'chose', and prints if you won, or if the computer won

MattDMo
  • 100,794
  • 21
  • 241
  • 231

0 Answers0