17th Sep 2017, 5:45 PM
Oma Falk
Oma Falk - avatar
4 Answers
+ 3
so here is the answer the resultant data type of an expression in the largest data type in the expression so when you do: short(a)*float(1.5) the resultant is biggest data type i.e float hence result will be 3.0 but since func takes an int hence, 3.0 will be truncated to 3 next you do int(a)/int(4) here biggest data type is int so the resultant will be 0 so for func x=3,y=0 thus result will be 3 if you don't believe print the variables in function
17th Sep 2017, 6:51 PM
Prince Gupta
Prince Gupta - avatar
+ 3
@Talha I checked and replaced the output to myfunc. It is the same result.
17th Sep 2017, 6:22 PM
Oma Falk
Oma Falk - avatar
+ 2
@Prince Gupta You are right.
17th Sep 2017, 7:09 PM
Talha Tariq
Talha Tariq - avatar
+ 1
We can solve this by just changing the data type of resultant... https://code.sololearn.com/ckK6KcSW4Hd5/?ref=app
17th Sep 2017, 7:12 PM
Talha Tariq
Talha Tariq - avatar