0
For calculation are quotes required to get the output?
5 Réponses
+ 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
+ 1
What? Please explain.
+ 1
>>>print(1+1) or>>>print('1+1') which is correct
+ 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.
0
if you want to get '1+1' then print('1+1')
if you want to get 2 print(1+1)