Practice Makes Perfect


Why does the program recognize "if number % 3 == 0" as correct? Only 0/3=0 so shouldn't the correct answer be "if number % 3 == int()"?


Can you explain to me how you think the modulo operator (%) works? So i can confirm my theory, that indeed there is the problem

that last one doesn't make much sense, int() is a function to convert to integer


I think that the % operator is the divisor symbol. In this case, its dividing number by 3 right?


so, if % is division operator, then by your logic:

14 % 3

will output 4.6667, or 4 (given python rounds down)

but / is the division operator, % calculates the remainder (for 14 % 3, this would be 2, 12 is the biggest possible division, so there is two remaining)

the modulo operator is useful to check if a number is divisible by the divider, because the remainder equals zero


I see. Thanks for correcting me and providing me with the new info! :slight_smile:


all sorted out now?


Yep thanks to your help! :grinning: