+ 2
why has to be int("2")+int("3"), not just 2+3
4 Réponses
+ 23
"2" and "3" are strings - if you add them (concatenate) together, you will get "23" - which will still be a string.
If you want to add 2 + 3, simply add 2+3 :)
If you have strings like above and still want to add them like numbers, you have to tell Python that you want to treat them like numbers - that's what int() is for - it converts string to numbers (if the string contains digits exclusively).
+ 15
print("2" + "3")
# outputs 23
print(int("2") + int("3"))
# outputs 5
print(2 + 3)
# outputs 5
+ 11
a=2+3
print(a)
# it can be 2+3
+ 8
@hosein
it can't print a
I think you meant sum
copier ;)