Syntax Error (elif statement)

I’m following a tutorial on youtube on how to code a very simple game.
The part of my code which recieves the error looks like this:

player_choice = input()

if player_choice == '1':
    monster['health'] = monster['health'] - player['attack']
    player['health'] = player['health'] - monster['attack']
    print(monster['health'])
    print(player['health']
elif player_choice == '2':
    print(Heal Player)
else:
    print(Invalid Input)

The error I recieve:

    elif player_choice == '2':
    ^
SyntaxError: invalid syntax

I’ve compared my codes with the tutorial and it is almost exactly identical
Heres the video for reference: https://youtu.be/kDdTgxv2Vv0?t=1843

Hey @web5654903635

You forgot a closing parentheses

right here:

1 Like

Thank you man, I do have another question, why does it tell me that the error was the elif statement on the exact same line as the statement was (line 15 in vs code) and not line 14 where the error truly was.

This topic was automatically closed 18 hours after the last reply. New replies are no longer allowed.