+ 2

Why when i do the operation simple >>> 2+2 the code playground give me sintax error

when i do a operation with +,-,/,*. the output result a sintax error , why ?

14th Feb 2018, 4:27 PM
Giampaolo
2 Antworten
+ 5
Please write print(2+2) We use print(), it's called print function,it shows result/output in Python.
14th Feb 2018, 5:06 PM
📈SmileGoodHope📈
📈SmileGoodHope📈 - avatar
+ 3
Be mindful of whether you are writing your code in an interpreter vs. running a script. When you type 2+2 into the python interpreter and hit enter, the interpreter will evaluate the expression and the result (4) will be the output. But when you are writing a script, like we are in the code playground, you need to explicitly tell the computer to display the result on the screen. Use the print() function to do this, i.e. print(2+2). If this doesn't address your problem please feel free to let us know an example of what you're trying to do and we'll try and help. :)
15th Feb 2018, 10:58 PM
Ben Smylie (he/him)
Ben Smylie (he/him) - avatar