syntax error:invalid syntax | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

syntax error:invalid syntax

i wrote the code several times but it keeps saying that there's a syntax error.

31st Jul 2016, 1:05 PM
Gabriele Ledda
Gabriele Ledda - avatar
3 Answers
+ 1
please write the code syntax error is happen when you forget of use syntax in wrong way for example if x<5 print (5) syntax error because you forget (:) it should be (ifx<5 : )
31st Jul 2016, 2:38 PM
Ahmed Kamal
Ahmed Kamal - avatar
0
the problem keep appearing when i press shift after i write the else
31st Jul 2016, 3:34 PM
Gabriele Ledda
Gabriele Ledda - avatar
0
i don't know why you need to press shift after else but make sure that else is in the loop and it is down caps and you use (:) after else like that if xxxxxxx: print (aaaaa) else: print (zzzzz)
31st Jul 2016, 4:13 PM
Ahmed Kamal
Ahmed Kamal - avatar