Question: In Python format! Activity 2: Leap Year For this activity, you are to write a function called is leap_year(year): Given an integer year, this function
Activity 2: Leap Year For this activity, you are to write a function called is leap_year(year): Given an integer year, this function returns whether or not year is a leap year (True if it is a leap year and False if it is not) def is_leap_year(year) "Return whether or not a year is a leap year:" A leap year is a year with 366 days and is necessary to keep the calendar synchronized with the sun because the earth revolves around the sun once every 365.25 days. (Actually that figure is not entirely precise, and for all dates after 1582 the Gregorian correction applies). You can assume that year you are given will be greater than or equal to 1582 Usually years that are divisible by 4 are leap years, for example 1996. However, years that are divisible by 100 (e.g. 1900) are not leap years, but years that are divisible by 400 are leap years (e.g. 2000) Once you have defined the function, you should be able to do the following is leap year( 1996 True is_leap_year 1900) False is_leap_year(2000) True
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
