I don't understand the floor division and the module operator | SoloLearn: Learn to code for FREE!

0

I don't understand the floor division and the module operator

Python

3/14/2020 7:23:32 PM

Maduanusi Victor

2 Answers

New Answer

0

Think of floor division as how many times the number will go into the other with no decimals. Eg. 10//3 will equal 3 instead of 3.33333. Module is like thinking of how many integers you are from being even. Eg. 10%3 = 1 because 3 can go evenly into 9 which is one away from 10. 9%3 = 0 because it divides evenly into 9 with no remainder. Hope that helps but I am sure there are lots of people who will reply to this comment with good explanations.

0

To add to what Derick Smith said, floor is basically taking only the non-decimal part of the answer of the division. Modulo (or modulus, I forget which is the correct name. It's the % symbol) just takes the remainder of the 2 numbers.