Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I know it looks like several questions but all these parts are supposed to solve one whole code that I am struggling to create beyond
I know it looks like several questions but all these parts are supposed to solve one whole code that I am struggling to create beyond naming the functions in Python 3.6....
The three overall steps of the calendar year program are getting the requested year from the user, creating the calendar year structure, and displaying the year. The functionality of displaying the calendar year is not too complex and can be contained in a single function. However, constructing the calendar year takes significantly more steps. Part of a well designed program is to break those steps up, along their logical boundaries into their own functions. Implement the following functions to produce a program that can construct and display a calendar year: (a) def leap year (year): Returns True if the input argument year is a leap year. Oth- erwise, returns False. Check http://en.wikipedia.org/wiki/Leap-year#Algorithn for how to do this. (b) def day of.veek.jan1 (year): Returs the day of the week for January 1 of the in- put argument year. year must be between 1800 and 2099. The returned value must be in the range 0-6 (where 0-Sun, 1-Mon,6-Sat). Check http://en.vikipedia org/wiki/Deterination-of-the-day-of-the-week#Gauss . 27-algorithm for how to do this. The weekday of the first of January in year A is given by: d- R(15R(A 1,4) +R(A ,100) +6R(A 1,400),7) where R(y, r is a function that returns the remainder when y is divided by r. In Python, it is similar to executing y % x. (c) def num daysinmonth (month.num, leapyear): Returns the number of days in a given month. monthnu must be in the range 1-12, inclusive. leap.year must be True if the month oceurs in a leap year. Otherwise, it should be False (d) def construct.cal month (month nu, firat day of month, nu_daysinmonth) Returns a formatted calendar month for display on the screen. month_num must be in the range 1-12, inclusive firat day ofmonth must be in the range 0-6 (where 0-Sun, 1-Mon,.. 6-Sat). Return a list of strings of the form [month name, veek, week2,....1 For example, the first two weeks of January 2015 will be 'January'," as the first two weeks for January 2015 will be displayed as 1 2 3',45678 9 10' 4 5 6 7 8 9 10 If the number of days of the last week is less than seven, no spaces are added after the last date. For example, the last week of December 2015 will beStep 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