Practice makes perfect but not a lot of sense


#1

What is the % function? How does if n % 3 tell you n whether or not n is evenly divisible by 3?


#2

% is a modulo operator and means that it returns a remainder from division. fe. 5 / 2 = 2 and remainder of 1, so same 5 % 2 will return 1 (as it returns only remainder part. so in this excercise we know that if remainder of division by 3 is equal to 0, that number is evenly divisible by three. in the logical sentence it will be:
n % 3 == 0
and that is not a math formula but logical sentence, meaning: if left is equal right, so if divisional remainder of n by 3 (left) is equal to 0 (right) and it can hold values: True or False. So fe. if your n = 3 this sentence will be True as 3 / 3 = 1 with remainder of 0 and this is what we are checking here.