Question: Python I cannot figure out why this isn't working. I'm trying to calculate if a leap year. Where is my error? def isLeapYear(year): leapYear =
Python
I cannot figure out why this isn't working. I'm trying to calculate if a leap year. Where is my error?
def isLeapYear(year): leapYear = False for thing in year: while (int(thing) % 4 == 0) and not (int(thing) % 100 == 0 and int(thing) % 400 != 0): leapYear = True return print("Is it a leap year?", leapYear) else: leapYear = False return print("Is it a leap year?", leapYear) isLeapYear(input("What Year?")) What Year? 2020 Is it a leap year? False
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
