CHFING Python Syntax problem Help

I just want to know,
Why int(a/b) or math.floor(a/b) is not working instead of a//b in this question or in general? What are the cases where using first 2 methods will give different results than a//b?

My solutions links where i have used following methods to code :

  1. int(a/b) :
  2. math.floor(a/b) :
  3. a//b :

Only 3rd one is AC.

I have read this stackoverflow post but it doesn’t explain case of both positive numers :

int(a/b) first calculates a/b which is a floating point number in python3.6 ( and they have precision issues ) and then converts it into an integer. Similar thing with math.floor(a/b).
1 2 more in depth

1 Like

You lost some precision, when you convert float into int.

1 Like