+ 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???

19th Apr 2018, 1:56 PM
RAJ CHHATBAR
2 RĂ©ponses
+ 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.
19th Apr 2018, 4:08 PM
📈SmileGoodHope📈
📈SmileGoodHope📈 - avatar
+ 1
ya thanks...
19th Apr 2018, 4:10 PM
RAJ CHHATBAR