python list for all months including leap years

Solutions on MaxInterview for python list for all months including leap years by the best coders in the world

showing results for - "python list for all months including leap years"
Macy
22 Nov 2018
1# A function to determine if a year is a leap year.
2# Do not change this function.
3def is_leap_year(year):
4    return (year % 4 == 0) and (year % 100 != 0) or (year % 400 == 0)
5
6# You should complete the definition of this function:
7
8def days_in_month(month, year):
9
10    if month in ['September', 'April', 'June', 'November']:
11        print 30
12
13    elif month in ['January', 'March', 'May', 'July', 'August','October','December']:
14        print 31        
15
16    elif month == 'February' and is_leap_year(year) == True:
17        print 29
18
19    elif month == 'February' and is_leap_year(year) == False:
20        print 28
21
22    else:
23        return None