+ 2
Why is int("3"+"4") =34
20 Respostas
+ 18
Both are string so it concatenates : "3" + "4" = "34"
When that string is passed to int() function, it returns 34
+ 11
it prints the character since its in quotations. take away the quotes and it'll do math
+ 4
if you wanted to get 7 as an answer you can try print(int("3")+int("4"))
+ 4
"3"+"4" is passed as the argument for type conversion to int. so it first concatenates before making it into int
+ 3
bro you have added two strings "/","/" like "h"+" I"=hi
+ 1
"3"+"4"="34"
+ 1
Because the string concat is done before the conversion to integer
+ 1
If you want to print 7 you must use this code:
print(3 + 4)
You get 34 because it takes the strings 3 and 3 and 4 and make it together (34).
+ 1
Code it like that... Int("4") +int("3")
+ 1
i think that you have to convert each one of this variable :)
+ 1
because, you in question dont use one string to program recognize a number!!! if you use inverted commas python recognize who a word and no who a number!
0
because they are strings and not numbers. Strings are treated as characters and not as numbers
0
see inside the brackets you are combining 2 string literals and the +sign concates those literals....then after doing the work inside brackets it is converted to integer literal i.e. 34
0
THE thing is that int() is not a value which you can simply take common like in mathematics. eg 2(3+4).
Cheers !!
0
It returns you number wit " " as a string. So: "number" + "number" is inerpreted number as a string of two numbers bonded by + sign.
0
because they are strings, they aren't numbers.
0
I tried typing int("3"+"4") in the console, but the message I got was 'no output'. Did anyone face a similar problem as well.?
0
"I tried typing int("3"+"4") in the console, but the message I got was 'no output'. Did anyone face a similar problem as well.? "
you have to typing it like that print(int(("3")+("4")))
0
when they are in quote the will consider as string then their addition is like string addition
0
As the first operation is to evaluate the brackets ("3" + "4") which results in a concatenation and after that result of it ("34") goes as an input to the int function