Why isnt this simple "rock paper scissors" program working in Python?
<p>Im new to python and Im trying to write a program in which the user plays rock paper scissors against the computer. However, i dont know why it isnt working. Heres the code:</p>

<pre><code>import random

computerResult = random.randint(1,3)

print("Lets play Rock Paper Scissors")
playerResult = input("Type 1 for Rock, 2 for Paper or 3 for Scissors: ")

if computerResult == 1:
    print("Computer says Rock")
if computerResult == 2:
    print("Computer says Paper")
if computerResult == 3:
    print("Computer says Scissors")


if playerResult == computerResult:
    print("Its a draw")
elif playerResult == 1 and computerResult == 2:
    print("You lose")
elif playerResult == 1 and computerResult == 3:
    print("You win")
elif playerResult == 2 and computerResult == 1:
    print("You win")
elif playerResult == 2 and computerResult == 3:
    print("You lose")
elif playerResult == 3 and computerResult == 1:
    print("You lose")
elif playerResult == 3 and computerResult == 2:
    print("You win")
</code></pre>

<p>When I run the program and play the game this is what i get:</p>

<pre><code>Lets play Rock Paper Scissors
Type 1 for Rock, 2 for Paper or 3 for Scissors: 1
Computer says Scissors
</code></pre>

<p>It doesnt say wether I won or lost and I cant figure out why</p>

<p>Because <code>playerResult</code> is a <code>str</code> and <code>computerResult</code> is <code>int</code>. And comparing string to int always results in <code>False</code></p>

<p>Change </p>

<pre><code>playerResult = input("Type 1 for Rock, 2 for Paper or 3 for Scissors: ")
</code></pre>

<p>To</p>

<pre><code>playerResult = int(input("Type 1 for Rock, 2 for Paper or 3 for Scissors: "))
</code></pre>

python python-3.x