Why result is 1.5 ? | Sololearn: Learn to code for FREE!

0

Why result is 1.5 ?

https://code.sololearn.com/cdbJijTSV6ED/?ref=app

9/5/2019 1:47:45 PM

UraL

1 Answer

New Answer

+2

As per https://stackoverflow.com/questions/3883004/the-modulo-operation-on-negative-numbers-in-python , remainder in python has to be always positive for positive and negative numbers . So in your example -25.5%2.25 = 1.5 , -25 could be represented as -12*2.25 + 1.5, that is why you got 1.5 as a result