Why would int("3"+"4") be 34 and not 7? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why would int("3"+"4") be 34 and not 7?

Please help I am a little confused. Also does int stand for integer?

6th Jul 2017, 5:27 PM
A
A - avatar
6 Answers
+ 15
Expressions inside parantheses are evaluated first. So, int("3" + "4") = int("34") = 34.
6th Jul 2017, 5:31 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 5
x=int("3")+int("4") print(x) then output is 7.
6th Jul 2017, 5:39 PM
Siva Brahma Chari Penuvarthi
Siva Brahma Chari Penuvarthi - avatar
+ 1
+ is used to concatenate in Python
6th Jul 2017, 5:34 PM
Arvind
Arvind - avatar
+ 1
and yes int stans for integer :p
6th Jul 2017, 5:45 PM
Masquerade
Masquerade - avatar
0
"3" is taken as a part of a series of numbers example: --> "1" + "2" +"3" at the end you will get =123
30th Jul 2017, 9:28 AM
PYM
PYM - avatar
- 1
irrespective of type + is used for concatenation..hence 34
30th Jul 2017, 11:57 AM
Arvind
Arvind - avatar