Python Forum
"SynatxError" Invalid Syntax Help - 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: "SynatxError" Invalid Syntax Help (/thread-22812.html)



"SynatxError" Invalid Syntax Help - Michael1 - Nov-27-2019

Hello, as I am writing my program, i wrote the code

x = 10
if x < 100

from here python automatically gives me the following message

SyntaxError: invalid Syntax

I tried switching the "<" around but it I still get the error and I also tried indenting the if statement, which gives me

SyntaxError:unexpected Indent

Can someone please tell what what is going on and how to solve this issues - Thanks in advance

PS: I am just building a program to build my skill (if someone is wondering why I am using that code)


RE: "SynatxError" Invalid Syntax Help - ichabod801 - Nov-27-2019

You need a colon at the end of the line with the if statement. Then the code after if is indented.

x = 10
if x < 100:
    print('Puny number.')
else:
    print('Number smash!')



RE: "SynatxError" Invalid Syntax Help - Michael1 - Nov-27-2019

Thank you!