Integers and Strings | SoloLearn: Learn to code for FREE!


Integers and Strings

If I type print(int("5" + "5")) it become 55 and not 10 ? I thought putting int first will make it into an int

4/12/2020 5:53:18 AM


5 Answers

New Answer


It witll return 55 because it runs first the codes in the bracket. If you want it to return 10 you should run the code like this print(int("5")+int("5")) this will allow to first transform the strings into integers and then sum the integers.


Inside items are taken as string not as integers because of ("" ) marks


If it will be int( 5 + 5 ) this will result in 10


First it will evaluate what is inside the brackets so "5"+"5" becomes 55 as it is a string then I will convert 55 to integer


Alright thx