+ 4

Can anyone help me?

I didn't really understand the quotient and remainder. please explain it to me.

19th Apr 2017, 2:53 PM
khalid
khalid - avatar
3 odpowiedzi
+ 27
If you divide 7 by 3, then the result is 2, because 3*2=6 and 6 is the nearest whole number. Thus the quotient is 2. Now what remains? 7-6 = 1. So 1 is the remainder.
19th Apr 2017, 2:59 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 7
Things get a bit tricky, though, when negatives come in: 14 % 5 = 4 14 % -5 = -1 -14 % 5 = 1 -14 % -5 = -4 It always counts the remainder comparing the dividend to the *lower* no-fraction number. So to 10 and -15 in the examples above, respectively. In Python, unlike some other languages, the modulo result always has the same sign as the divisor (observe the sign of 5 in the examples above).
19th Apr 2017, 3:40 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 4
thanks for explaining it
19th Apr 2017, 3:12 PM
khalid
khalid - avatar