The error in the syntax of the code is in the else
statement. The correct syntax does not require a condition after else
. Here’s the corrected version:
def is_year(year):
if year % 4 == 0:
print('Year is divisible by 4')
else:
print('Year is not divisible by 4')
So the specific error is that the line else year % 4 != 0:
is incorrect; it should simply be else:
without the condition.