int ("2"+"3") | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
+ 5

# int ("2"+"3")

why the answer is 23. I was thought that the answer is 5.

30th Jun 2019, 7:10 PM
May Thazin Nyein
7 ответов
+ 7
the bracket or parenthesis operation is to be performed first i.e ("2"+"3") which is ("23") and still a string type...then int("23") will convert "23" to 23 which is now an integer data type
30th Jun 2019, 9:57 PM
ᎯᏰᏰᎯ__ᏥᎿᏩ➰
+ 6
int('2') + int('3') = 5
30th Jun 2019, 8:28 PM
Anna
+ 5
"2” is a string and “3” is a string, so “2” + “3” = “23” because it’s not a number it’s a string. However, 2 is an integer and 3 is an integer, so 2 + 3 = 5
30th Jun 2019, 8:03 PM
Pete Cowling
+ 4
You first do "2"+"3"="23" and next int("23")=23
30th Jun 2019, 7:11 PM
Werg Serium
+ 3
The operations inside the parenthesed are operated before calling the int constructor.
30th Jun 2019, 8:05 PM
Seb TheS
+ 2
"2" and "3" are strings so they will concatenate and therefore become 23
30th Jun 2019, 9:12 PM
Moksh Haria
+ 2
Type ("2")>>>str #Cadena Type ("3")>>>str #Cadena Concatenación: "2"+"3"="23" type(int("23")) >>>int #Entero
30th Jun 2019, 10:37 PM
Denis Omar
Актуальное сегодня
React course
0 Votes