+ 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')?
7 Respuestas
+ 8
Because when you are receiving input you may have the variables be strings and then have to do operations on them
+ 5
user inputs are by nature strings, so sometimes converting is necessary in order to execute arithmetic operations
+ 2
some times you as output not an integer, and you must convert what you have
+ 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 .
0
Without using the 'Int' you cannot operate mathamatical operations
0
To convert concated string '23' to integer 23 so we can perform mathatical operations on it.
0
bcoz u may require strings and numerals at the same time consequitively one after another.