title: python ignoring if statement
body: <p>I've been working on a python program where the user plays rock, paper, scissors against the computer.</p>
  
  <p>The user is prompted to enter 0 for paper, 1 for rock, and 2 for scissors. My program would print what each player chose and ideally I wanted it to also say something like "Paper covers rock. You win" but i can't seem to get my if statements to work and also I want my program to print "you chose paper" etc. but instead of the words rock, paper, or scissors it still says 0,1, and 2.</p>
  
  <p>I tried assigning paper = 0. I thought maybe it wasn't working because the numbers weren't strings so I tried adding parentheses paper = "0", but that didn't work either. Also, when I created the variable 'player' I thought I correctly used the string function to turn whatever integer was entered into a string, but maybe there's something I'm not seeing.</p>
  
  <p>Later I tried avoiding assigning paper, rock, and scissors to the integers and instead creating new variables. However, the new variables created within my if statements were declared as undefined so I must have messed it up somehow. I'm confused as to why it doesn't work because someone else wrote a program for the same purpose using if statements to create new variables and his program worked.</p>
  
  <p>Another place I thought there might be an error is how i ended my if statements with elif instead of else so I changed that and got another an incorrect syntax error. I've been reading my textbook and searching the internet so I'm sorry if I've missed something that should be obvious. I'm super, super, super new to programming so my knowledge is very limited. This code has been warping so much today that i can't even remember how it was when it at least was able to finish compiling without running into an error.</p>
  
  <p>As this code is now it runs into an error because player1 is not defined. I'm sorry that this program is such an eye-sore.</p>
  
  <pre><code>    import random
      player = input(str("Enter 0 for paper, 1 for rock, and 2 for scissors:" ))
      computer = str(random.randint(0,2))
      if player == 0:
         player1 == "paper"
      elif player == 1:
         player1 == "rock"
      elif player == 2:
         player1 == "scissors"
      elif computer == 0:
         computer1 == "paper"
      elif computer == 1:
         computer1 == "rock"
      elif computer == 2:
         computer1 == "scissors"
      print ("You chose " + player1 , "and the computer chose " , + computer1)
      if player == "paper" and computer == "rock":
         print("Paper covers rock. You win!")
      elif player == "paper" and computer == "scissors":
         print("Scissors cut paper. You lose!")
      elif player == "paper" and computer == "paper":
         print("You both chose paper. It's a draw!")
      elif player == "rock" and computer == "paper":
         print("Paper covers rock. You lose!")
      elif player == "rock" and computer == "rock":
         print("You both chose rock. It's a draw!")
      elif player == "rock" and computer == "scissors":
         print("Rock beats scissors. You win!")
      elif player == "scissors" and computer == "paper":
         print("Scissors cut paper. You win!")
      elif player == "scissors" and computer == "rock":
         print("Rock beats scissors. You lose!")
      elif player == "scissors" and computer == "scissors":
         print("You both chose scissors. It's a draw")
  </code></pre>
  
  <p>UPDATE: After a few errors have been brought to my attention I have fixed a few things and now my code looks like this:</p>
  
  <pre><code>    import random
  
      player = input("Enter 0 for paper, 1 for rock, and 2 for scissors:" )
      computer = random.randint(0,2)
  
      if player == 0:
         player1 = "paper"
      elif player == 1:
         player1 = "rock"
      elif player == 2:
         player1 = "scissors"
  
      if computer == 0:
         computer1 = "paper"
      elif computer == 1:
         computer1 = "rock"
      elif computer == 2:
         computer1 = "scissors"
  
      print ("You chose " + player1 , "and the computer chose " + computer1)
  
      if player1 == "paper" and computer1 == "rock":
         print("Paper covers rock. You win!")
      elif player1 == "paper" and computer1 == "scissors":
         print("Scissors cut paper. You lose!")
      elif player1 == "paper" and computer1 == "paper":
         print("You both chose paper. It's a draw!")
      elif player1 == "rock" and computer1 == "paper":
         print("Paper covers rock. You lose!")
      elif player1 == "rock" and computer1 == "rock":
         print("You both chose rock. It's a draw!")
      elif player1 == "rock" and computer1 == "scissors":
         print("Rock beats scissors. You win!")
      elif player1 == "scissors" and computer1 == "paper":
         print("Scissors cut paper. You win!")
      elif player1 == "scissors" and computer1 == "rock":
         print("Rock beats scissors. You lose!")
      elif player1 == "scissors" and computer1 == "scissors":
         print("You both chose scissors. It's a draw")
  </code></pre>
  
  <p>and I am now getting the error:</p>
  
  <pre><code>   NameError: name 'player1' is not defined
  </code></pre>