I don't understand this part quotient and remainder | Sololearn: Learn to code for FREE!

+7

# I don't understand this part quotient and remainder

Python

6/24/2019 7:24:20 PM

Isaac Amankonah

+23

a = 10 b = 3 ———————————— quotient (a.k.a. floor division): a // b >>> 3 In words: how many times does 3 go in 10? Answer: 3 times ———————————- remainder (%) a % b >>>1 in words: What is the remainder of 10 divided by 3? Answer: 1 ———————————- Hope this helps 😊

+7

Thank you

+6

Isaac Amankonah >> 20 // 6 3 // is called floor division or integer division as it gives you the the whole int part of the division. by normal division you know 20 divide by 3 = 6.6666 but '//' chops of .6666 part and gives you 6 only >>> 1.25 % 0.5 0.25 % is a modulo operator also called remainder operator as it gives the remainder of the division 1.25 % 0.5 = 2 * 0.5 + 0.25 as remainder 20 % 6 = 2 how many times 6 divides 20 = 3 whole times. This whole times is also called quotient. so what remains after that = 2 20 = 3 * 6 + 2

+5

Really it's helps

+4

You‘re welcome 😊 Isaac Amankonah

+1

Isaac Amankonah , Can you be more specific?

+1

Thanks for the explanation ace

+1

You‘re welcome, Hammed Folorunso ☺️

+1

Thank you, who answer this :)

0

Thanks

0

How come 1.25 % 5 is 0.25 it should be 0 since remainder is 0. 0.25 is the quotient