Expected an indented block after 'elif' statement

Welcome to our community!

Indentation plays a very important role in Python. You should pay attention to this fact. Your code should look like the following:

if player == computer:
        return "It's a tie!"

    elif player == "rock":
        if computer == "scissors":
            return "rock smashes scissors! You win!"
        else:
            return "Rock smashes scissors! You win!"
    elif player == "paper":
        if computer == "rock":
            return "paper covers rock! You lose!"
        else:
            return "Scissors cuts paper! You lose." etc.

As you can see, the order must be followed when it comes to indentation.

Now, the program works fine:

1 Like