Adding numbers. Python. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Adding numbers. Python.

If it was adding two numbers like 23 and 67, on what conditions would you get 90 or 2367?

25th Jun 2018, 4:00 PM
Alisse Canre
Alisse Canre - avatar
3 Answers
+ 3
If you add them as ints you will get 90. If you add them as strings you will get 2367.
25th Jun 2018, 4:03 PM
deep_unlearning
deep_unlearning - avatar
+ 5
23 + 67 = 90 #addition of integers '23' + '67' = '2367' # concatenation of strings
25th Jun 2018, 4:03 PM
Ulisses Cruz
Ulisses Cruz - avatar
+ 3
if both are strings then 2367 if both are integers then 90
25th Jun 2018, 5:53 PM
Maninder $ingh
Maninder $ingh - avatar