Files
mathgenerator/mathgenerator/funcs/misc/is_leap_year.py

25 lines
664 B
Python

from .__init__ import *
def IsLeapYear(minNumber=1900, maxNumber=2099):
year = random.randint(minNumber, maxNumber)
problem = "Year " + str(year) + " "
solution = ""
if (year % 4) == 0:
if (year % 100) == 0:
if (year % 400) == 0:
solution = "is a leap year"
else:
solution = "is not a leap year"
else:
solution = "is a leap year"
else:
solution = "is not a leap year"
return problem, solution
is_leap_year = Generator("Leap Year or Not", 101,
IsLeapYear,
["minNumber=1900", "maxNumber=2099"])