+ 1

# How modulus work when we have proper fraction?

x = 2 print(x) # answer =2 x %= 3 print(x) # answer =2 i = 2%3 print (i) # answer =2 but 2/3 = 0.6666667 how it is working???

2 Answers

+ 1

Modulus doesn't show quotient, it always shows remainder.
2%3 = 2
here
2 is divided by 3 and only want the result of remainder, 2 is remainder.
Here, fractional value isn't accepting, only integer value is in consideration.

+ 1

ya thanks...