Days in month function using Python
Posted by Samath
Last Updated: January 20, 2024

Write a function days_in_month which takes a month as an argument and finds the corresponding month in the month_days list and returns the number of days associated with that month.

>>> days_in_month('December')
>>> days_in_month('February')
[28, 29]


def days_in_month(month):
    for i in month_days:
        if month==i[0]:
            return i[1]