+ 5
int ("2"+"3")
why the answer is 23. I was thought that the answer is 5.
7 Réponses
+ 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
+ 6
int('2') + int('3') = 5
+ 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
+ 4
You first do "2"+"3"="23" and next int("23")=23
+ 3
The operations inside the parenthesed are operated before calling the int constructor.
+ 2
"2" and "3" are strings so they will concatenate and therefore become 23
+ 2
Type ("2")>>>str #Cadena
Type ("3")>>>str #Cadena
Concatenación:
"2"+"3"="23"
type(int("23")) >>>int #Entero