For calculation are quotes required to get the output? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

For calculation are quotes required to get the output?

11th Jan 2017, 6:01 AM
Anuhya
5 Answers
+ 4
the first one ^^ if you want the output to be 2 if you want the output to be 1+1 then use the secound one
11th Jan 2017, 6:09 AM
Kamil
Kamil - avatar
+ 1
What? Please explain.
11th Jan 2017, 6:06 AM
Dao
Dao - avatar
+ 1
>>>print(1+1) or>>>print('1+1') which is correct
11th Jan 2017, 6:08 AM
Anuhya
+ 1
Python automatically converts int types into strings when printing, so that 1 + 1 sends 2 to the print function, that then converts 2 to "2". No need to worry about it.
11th Jan 2017, 6:51 AM
Dao
Dao - avatar
0
if you want to get '1+1' then print('1+1') if you want to get 2 print(1+1)
11th Jan 2017, 2:30 PM
ramzi
ramzi - avatar