- 1

Quotient and Remainder (Problem)

Im new to this app and just started my course on Python and i thought it was gonna be easy then this hit me. If anybody can help me with this problem i would appreciate it.

19th Nov 2017, 2:53 PM
LTDZ
LTDZ - avatar
4 Answers
+ 4
What exactly seems to be problematic for you? You want the quotient and remainder to be explained or what?
19th Nov 2017, 3:20 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
+ 4
// is a floor division operator. A//B informs you how many times does B fit into A. Example: 14//3 = 4, because 3 fits 4 times in 14 -- 3 * 4 = 12 and if you'd try to fit one more 3 there, it would already be more than 14. However, in the example above, there is still a difference of 2 between 12 (4 full fits of 3) and 14. This exactly is this remainder you were wondering about. 14%3 equals 2 as it it the difference between the highest possible number of full fits of 3 (12) and the dividend -- 14. Why is the former one called "floor" division? Well, it always returns the *next lowest integer* which is important when negative numbers are considered. 14 // 3 = 4 (14/3 would be 4.666, so the next lowest integer is 4) 14 // -3 = -5 (14/-3 would be -4.666, so the *next lowest integer* is -5) It is a bit confusing, you just have to remember that.
19th Nov 2017, 4:09 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
0
Im confused in this part >>> 20 // 6 3 >>> 1.25 % 0.5 Teach me your ways master ._.
19th Nov 2017, 3:46 PM
LTDZ
LTDZ - avatar
0
Thank you for the help 😃
19th Nov 2017, 4:15 PM
LTDZ
LTDZ - avatar