James W. answered 06/23/23
MIT Math and Computer Science Teacher
Hi,
Please see the above code.
(1) first we define a function which will return the number of days in a given month specified.
As you can see we use a reference list of the days in each month, in an ordinary year
(2) if the year is divisible by 4 and the month is 2 (ie February) we need to add 1 more day to our reference
(3) we return the relevant entry in the reference list
Hope this helps!