Python Forum
Syntax Error (elif statement) - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Syntax Error (elif statement) (/thread-22640.html)



Syntax Error (elif statement) - Kanashi - Nov-20-2019

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']

edit 2: Nvm I solved i, forgot parantheses at player health
    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

edit: This is what's stated in the "problems" tab in VS code (line 15 in VS code being Line 8 in here, since I cut some of the code out ofc):
"message": "invalid syntax (<unknown>, line 15)"