Question: Write a Python module called calutils.py, and we need you to write this. The module should contain the following functions: is_leap_year (year) Given a year
Write a Python module called calutils.py, and we need you to write this.
The module should contain the following functions:
is_leap_year (year)
Given a year (a 4 digit number), returns true if it is a leap year, and false otherwise.
month_name (number)
Given the number of a month, returns the corresponding name. 1 is January, ..., 12 is December.
days_in_month (month_number, year)
Given a month (in the form of a number) and (4 digit) year, return the number of days in the month (accounting, in the case of February, for whether or not it is a leap year).
first_day_of_year (year)
Given a 4 digit year, return the number of the day on which January 1st falls. 0 is Sunday, , 6 is Saturday. (See question 2 of assignment 2.)
first_day_of_month(month_number, year)
Given a month (in the form of a number) and (4 digit) year, return the number of the day on which the first of that month falls. 0 is Sunday, , 6 is Saturday.
In each case weve given the name of the required function and its parameters.
Here is a sample transcript:
Choose from the following options:
0. quit
1. Test is_leap_year().
2. Test month_name().
3. Test days_in_month().
4. Test first_day_of_year().
5. Test first_day_of_month().
1
Enter the year (4 digits):
2016
The year 2016 is a leap year.
Choose from the following options:
0. quit 1.
Test is_leap_year().
2. Test month_name().
3. Test days_in_month().
4. Test first_day_of_year().
5. Test first_day_of_month().
2
Month number 1 is January.
Month number 2 is February.
Month number 3 is March.
Month number 4 is April.
Month number 5 is May.
Month number 6 is June.
Month number 7 is July.
Month number 8 is August.
Month number 9 is September.
Month number 10 is October.
Month number 11 is November.
Month number 12 is December.
Choose from the following options:
0. quit 1.
Test is_leap_year().
2. Test month_name().
3. Test days_in_month().
4. Test first_day_of_year().
5. Test first_day_of_month().
0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
