Why do I keep getting SyntaxError: invalid syntax in line 2? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why do I keep getting SyntaxError: invalid syntax in line 2?

Here is my code: x=4 If x==5: Print("hello") elif: x==7: Print("greeting") elif: x==4: print("HI")

8th Nov 2016, 8:52 AM
An Bùi
An Bùi - avatar
1 Answer
+ 4
x=4 if x==5: Print("hello") elif x==7: Print("greeting") elif x==4: print("HI") identations are very important in python also there were obsolete ':' just after the elif statements and the first if was with a capital I
8th Nov 2016, 8:54 AM
Burey
Burey - avatar