I can't calculate anything in the code sand box pls help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I can't calculate anything in the code sand box pls help

so i was messing around in the code sand box and did 2 + 2 or something like that and it didn't work i also tried print ('2 + 2')

2nd Jun 2019, 4:46 PM
hewman
hewman - avatar
3 Answers
+ 3
It didn't work because it was a whole string, so the plus sign was also a character. To do it, you should put the plus sign outside of the string. 2 + 2 # = 4 "2" + "2" # = 22 "2" + 2 # Error, can't ad strings and integers
2nd Jun 2019, 4:54 PM
Airree
Airree - avatar
+ 3
print (2 +2) #no quotes.
2nd Jun 2019, 4:56 PM
Paul
Paul - avatar
+ 1
Thx to both of you
2nd Jun 2019, 4:59 PM
hewman
hewman - avatar