% is always an integer and always gives as small positive X as possible. % = -6 in this case.

So 27-6*4 = 3.

The problem here is they describe % as the remainder of a division previously, which would be 0.75 in this case, 27/4 = 6.75. That would probably throw an error since its not an integer

An operator cannot be an integer, it’s an operator. We can use the remainder operator on all numbers, floats or integers. The outcome is the physical remainder of the division.

27 / 4 = 6.75

but .75 is not the remainder. The remainder is 0.75 * 4 => 3.

Semantics, the % operator has several qualities one of them being that of an integer and it is represented by an integer in the correct equation I gave. I am not a programmer neither a mathematician but is not 0.75 what is left after you remove the integer 6 from 6.75. Does remainder have another meaning here?

Thank you all. Even though i am not 100% clear, i have a fair idea and i beleive it will get better as we move forward. I am a beginner with not computer or solid arithmetic background.

It is not your team number, it is what number you are in your team of four, it’s telling you if you are the 1st one, 2nd one, 3rd one, or the 4th one in your team.

There are only 4 teams. Each person counts off. We know there are at least 27 people in line since the lesson says we get number 27. 27 % 4 = 3, so we are on the third team.

First team: [1, 5, 9, 13, 17, 21, 25] ##any of these numbers % 4 = 1
Second team: [2, 6, 10, 14, 18, 22, 26] ##any of these numbers % 4 = 2
Third team: [3, 7, 11, 15, 19, 23, 27] ##any of these numbers % 4 = 3
Fourth team: [4, 8, 12, 16, 20, 24, 28 ] ##any of these numbers % 4 = 0

Take any of the numbers from any team, and perform the modulo operation, and you’ll confirm that they are on the correct team.

In this case being number 27, we are the 7th person selected for the third team.

As far as I know, a number is divisible by another one if the division is exact (no remainder). Thus, modulo operator is just perfect for that matter. If the result of modulo operation is zero, that number is divisible.

As for the actions every nth-time, inside a for loop, using an if statement with your counter variable and the modulo operator allows you to perform actions every nth-time.

For example, doing whatever every 4th character in a string:

counter = 0
for i in random_string :
if counter % 4 == 0 :
_do_whatever_
counter += 1