Answered step by step
Verified Expert Solution
Question
1 Approved Answer
##CODE IN PYTHON Exercise 7 Leap years are years with 366 days instead of 365 (february has 29 days instead of 28 during leap years).
##CODE IN PYTHON
Exercise 7 Leap years are years with 366 days instead of 365 (february has 29 days instead of 28 during leap years). Write a function isLeapYear that returns true if the parameter is a leap year and false otherwise. How to know if a year is a leap year? Here is the rule: - A leap year occurs on all years divisible by four (e.g., 2016, 2020, 2024, and so on). - However, the exception to this rule is that years divisible by one hundred (e.g., 2100, 2200, 2300 , and so on) aren't leap years. - And the exception to this exception is that years divisible by four hundred (e.g., 2000, 2400, and so on) are leap years. Do not forget docstrings! Test your function with the below assertions: assert isLeapYear (1999)== False assert isLeapYear (2000)== True assert isLeapYear (2001)== False assert isLeapYear (2004)== True assert isLeapYear (2100)== False assert isLeapYear (2400)== TrueStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started