Elif statements not printing
<p>I'm doing a basic rock paper scissors code for school, but my elif statements aren't running.</p>

<pre><code>def player1(x):
    while x != 'rock' and x != 'paper' and x != 'scissors':
        print("This is not a valid object selection")
        x = input("Player 1? ")

def player2(x):
    while x != 'rock' and x != 'paper' and x != 'scissors':
        print("This is not a valid object selection")
        x = input("Player 2? ")

def winner():
    player1(input("Player 1? "))
    player2(input("Player 2? "))
    if player1 == 'rock' and player2 == 'rock':
        print('Tie')
    elif player1 == 'paper' and player2 == 'paper':
        print('Tie')
    elif player1 == 'rock' and player2 == 'paper':
        print('Player 2 wins')
    elif player1 == 'paper' and player2 == 'rock':
        print('Player 1 wins')
    elif player1 == 'rock' and player2 == 'scissors':
        print('Player 1 wins')
    elif player1 == 'scissors' and player2 == 'rock':
        print('Player 2 wins')
    elif player1 == 'paper' and player2 == 'scissors':
        print('Player 2 wins')
    elif player1 == 'scissors' and player2 == 'paper':
        print('Player 1 wins')
    elif player1 == 'scissors' and player2 == 'scissors':
        print('Tie')

winner()
</code></pre>

<p>When I run this code, it asks for 'Player 1?' and won't accept anything other than rock, paper, or scissors. It then proceeds to do the same for player2. However, this is where the code ends, and it will not run my elif statements and print which player wins.</p>

<p>Edit: Solved. Thanks for helping a beginner. I was completely forgetting to return the strings and assign them to variables.</p>

<p>Assigning to x inside <code>player1</code> isn't doing anything. As soon as the function returns, the value assigned to x is dropped. That means you are discarding your input! Then you are comparing the <em>function</em> <code>player1</code> to a <em>string</em> that might or might not match your input.</p>

<p>Suggestion for debugging: Whenever you have a flow-of-control problem, print out the control variable. Here, if you print player1, you will see something surprising.</p>

python