+ 2

Can anyone tell me what's d use of this int function?

One can simply do 2+3 why wud someone try to do int('2'+'3')?

6th Dec 2015, 3:06 AM
Bilawal Sharma
Bilawal Sharma - avatar
7 Answers
+ 8
Because when you are receiving input you may have the variables be strings and then have to do operations on them
14th Dec 2015, 2:32 AM
Alex Lange
Alex Lange - avatar
+ 5
user inputs are by nature strings, so sometimes converting is necessary in order to execute arithmetic operations
16th Feb 2016, 12:24 PM
Dave Wright
Dave Wright - avatar
+ 2
some times you as output not an integer, and you must convert what you have
24th Dec 2015, 6:13 PM
dmitriy shvedchenko
dmitriy shvedchenko - avatar
+ 1
a="5" b="6" print (a+b) print (int (a)+int (b)) o/p - 56 11 if u r using any no. as string in any variable then to calculate it as string u can simply write it in print () but to manipulate it as integer int () is used .
23rd Oct 2016, 6:19 AM
Shivani Gupta
Shivani Gupta - avatar
Without using the 'Int' you cannot operate mathamatical operations
7th Jul 2016, 11:19 AM
Avaneesh Yadav
Avaneesh Yadav - avatar
To convert concated string '23' to integer 23 so we can perform mathatical operations on it.
7th Aug 2016, 11:57 AM
Pradeep Bilaiya
Pradeep Bilaiya - avatar
bcoz u may require strings and numerals at the same time consequitively one after another.
31st Oct 2016, 6:55 PM
Devaashish Sharma