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:48:06 PM

UraL

3 Answers

New Answer

+7

A neat mathematical trick: -n % k = k - (n % k). Meaning, to find (βˆ’n)%k, just find kβˆ’(n%k). Have fun!

+5

In python sign of result of mod is sign of denominator see this link and follow the links mentioned in link https://stackoverflow.com/q/3883004/7986108

+1

Ace Clear