what's wrong in my syntax ?????? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what's wrong in my syntax ??????

>>> 2 + 2 output is invalid syntax

16th Aug 2016, 6:26 PM
Shivam Bhatnagar
Shivam Bhatnagar - avatar
4 Answers
+ 2
I agree. You should use the print() method. Otherwise, the the interpreter will not be able to tell what you want it to do.
16th Aug 2016, 8:30 PM
Devon McCauley
Devon McCauley - avatar
+ 2
If u type >>>2+2 on python installed on ur pc in terminal then it will give u 4. But while coding this is not correct since code does not specify what does should be done with it so use print() statement. Upvote me if my answer helped and happy coding :-)
16th Aug 2016, 9:31 PM
John
+ 1
try print (2+2), 2+2 is not output
16th Aug 2016, 6:29 PM
‫Ido Tal
‫Ido Tal - avatar
0
you should add quote to it ('2+2')
16th Aug 2016, 9:00 PM
Haythem Kanzari
Haythem Kanzari - avatar