invalid syntax
Answered
I have newly installed pycharm 2017.2.3.
i have tried to run this simple code:
x = [10]
if x > 5;
print(X)
but whenever i run the code it shows the following error
File "C:/Users/ACER/PycharmProjects/untitled1/name.py", line 2
if x>5
^
SyntaxError: invalid syntax
Process finished with exit code 1
please help me to solve it
Please sign in to leave a comment.
Hi Siyam! There should be colon after if expression, print also should have 4 space indentation, like that:
Thank you very much.
I always made the mistake of putting semicolon instead of colon
Num1 = int(input('What is your 1st Number'))
Num2 = int(input('What is your 2nd number'))
if Num1<Num2:
SENTENCE = Num2
SENTENCE1 = int("is greater number than")
SENTENCE3 = Num1
print(SENTENCE + SENTENCE1 + SENTENCE3 )
else: print(Num2 + int("is greater number than"))
WHAT IS WRONG IN HERE
Num1 = int(input('What is your 1st Number'))
Num2 = int(input('What is your 2nd number'))
if Num1<Num2:
SENTENCE = Num2
SENTENCE1 = int("is greater number than")
SENTENCE3 = Num1
print(SENTENCE + SENTENCE1 + SENTENCE3 )
else: print(Num2 + int("is greater number than"))
WHAT IS WRONG IN HERE
Try this: