+ 4
I cant believe that output!
4 Antworten
+ 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
+ 3
@Talha
I checked and replaced the output to myfunc.
It is the same result.
+ 2
@Prince Gupta
You are right.
+ 1
We can solve this by just changing the data type of resultant...
https://code.sololearn.com/ckK6KcSW4Hd5/?ref=app