Question: Spider 2 question 1: given : Write code to determine whether a year is a leap year. Use the mod function. The rules for determining

Spider 2 question 1: given :

Write code to determine whether a year is a leap year. Use the mod function. The rules for determining leap years in the Gregorian calendar are as follows:

All years evenly divisible by 400 are leap years.

Years evenly divisible by 100, but not by 400, are not leap years.

Years divisible by 4, but not by 100, are leap years.

All other years are not leap years.

For example, the years 1800, 1900, 2100, 2300 and 2500 are not leap years, but 2400 is a leap year.

Question 1) Repeat SPIDER 2 Q1, but write a function that accepts a year as an input argument and determines whether that year is a leap year. The output should be the variable extra_day, which should be 1 if the year is a leap year and 0 otherwise.

You must write a script file that thoroughly tests whether your function works correctly.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!