convert int from str | Sololearn: Learn to code for FREE!
+ 1

convert int from str

int("3" + "4") why this code prints 34. Didn't we convert it to int by putting "int" of the parenthesis?

24th May 2017, 8:07 PM
Oguz Altinbas
Oguz Altinbas - avatar
1 Resposta
+ 6
If you want + work with int, you have to write int("3")+int("4") In your case plus worked with string, and when result cast to int
24th May 2017, 8:10 PM
shaldem - avatar