curriculum/challenges/english/blocks/daily-coding-challenges-python/69306364df283fcaff2e1ad8.md
Given an integer year, determine whether it is a leap year.
A year is a leap year if it satisfies the following rules:
is_leap_year(2024) should return True.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_leap_year(2024), True)`)
}})
is_leap_year(2023) should return False.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_leap_year(2023), False)`)
}})
is_leap_year(2100) should return False.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_leap_year(2100), False)`)
}})
is_leap_year(2000) should return True.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_leap_year(2000), True)`)
}})
is_leap_year(1999) should return False.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_leap_year(1999), False)`)
}})
is_leap_year(2040) should return True.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_leap_year(2040), True)`)
}})
is_leap_year(2026) should return False.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_leap_year(2026), False)`)
}})
def is_leap_year(year):
return year
def is_leap_year(year):
if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
return True
else:
return False