Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

###################################### Q2 ############################### # dowt = ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat') # day-of-week-tuple year = 2020 # cnt = 3 # 2020/1/1 is

image text in transcribed

###################################### Q2 ############################### # dowt = ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat') # day-of-week-tuple 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 011 for the twelve months # month = m+1 # this is the month to be displayed/printed. The way it is set up now, it will NOT change automatically # 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. # 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, ... 28 days. Year 2000 or any # century marks, multiples of 100, they are non-leap years, so only 28 days

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions