Does modulo need to be in parenthesis?

Hello, I have question about the use of parenthesis in this code:

def divisible_by_ten(nums):
count = 0
for num in nums:
if (num % 10 == 0): <-----
count += 1
return count

why is it giving me an error if I don’t have the module wrapped inside the parenthesis?

It works fine without parentheses (and you are right to expect it to, since mod has priority over comparison), both in my own IDE and the Codecademy interface:

capture

thank you Patrick, I probably missed something else to give me the error, but I completely forgot about mod priority, thanks for that mate!

1 Like