The error in the syntax of the provided code is:
You cannot add a conditional statement after the else keyword.
In Python, the else
statement does not take a condition; it should simply be followed by a colon and the block of code to execute if the if
condition is not met. The correct syntax should be:
def is_year(year):
if year % 4 == 0:
print('Year is divisible by 4')
else:
print('Year is not divisible by 4')