Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#%% Q2 ## ### ('Sun','Mon', 'Tue','Wed','Thu','Fri','Sat') # day-of-week-tuple # dowt = year = 2020 # cnt = 3 # 2020/1/1 is a Wednesday, so let
#%% Q2 ## ### ('Sun','Mon', 'Tue','Wed','Thu','Fri','Sat') # day-of-week-tuple # dowt = year = 2020 # cnt = 3 # 2020/1/1 is a Wednesday, so let us start a counting index of 3 for Wednesday, and keep adding one m = 3 # this will be a variable to be looped through eventually. I use the convention of 0-11 for the twelve months = m+1 # this is the month to be displayed/printed. The way it is set up now, it will NOT change automatically # month # when you change the value of m. Beware of that. # write a condition statement to determine the maxdays depending on the m value. # For example, when m=0 (Jan), maxdays should be 31, m=3 (Apr), maxdays should be 30, etc. # Try both ways, as a chunk of codes, or a one-liner maxdays = ????? print(maxdays) # Change your m value (between 0 and 11, inclusive) and run the chunk to see if prints out the correct result. 23 # Challenge: if you can take into account that year is multiple of 4, EXCEPT when year is multiple of 100, the days # in Feb should be 29. Otherwise, there should be 28. # Examples: 2004, 2008, 2012, Feb has 29 days, but 2001, 2002, 2003, 2005, 2006, # century marks, multiples of 100, they are non-leap years, so only 28 days. 28 days. Year 2000 or any
Step 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