dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
1.8 KiB
1.8 KiB
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 69306364df283fcaff2e1ad8 | Challenge 147: Leap Year Calculator | 29 | challenge-147 |
--description--
Given an integer year, determine whether it is a leap year.
A year is a leap year if it satisfies the following rules:
- The year is evenly divisible by 4, and
- The year is not evenly divisible by 100, unless
- The year is evenly divisible by 400.
--hints--
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)`)
}})
--seed--
--seed-contents--
def is_leap_year(year):
return year
--solutions--
def is_leap_year(year):
if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
return True
else:
return False