I am trying to determine if these years are leap years. 1900, 1999, 2000, 2001,2002,2003,2004
def leapyr(n):
if (n%4==0) and (n%100!=0):
if (n%400==0):
print (n, " is a leap year.")
elif (year%4!=0):
print (n, " is not a leap year.")
numbers = [(1900),(1999),(2000),(2002),(2003),(2004),]
results=[]
for x in numbers:
print(leapyr(numbers))
this is the error I am getting:
Traceback (most recent call last):
File "C:/Users/gx2410ls/hw 12.py", line 13, in <module>
print(leapyr(numbers))
File "C:/Users/gx2410ls/hw 12.py", line 2, in leapyr
if (n%4==0) and (n%100!=0):
TypeError: unsupported operand type(s) for %: 'list' and 'int'
You passed the wrong value. Use
print(leapyr(x))