def how_many_days_in(month): if month == 'January' or month == 'March' or month == 'May' or month == 'July' or month == 'August' or month == 'October' or month == 'December': return 31 elif month == 'April' or month == 'June' or month == 'September' or month == 'November': return 30 else: # Only February left return 28
def how_many_days_in(month): months_with_31 = ['January', 'March', 'May', 'July', 'August', 'October', 'December'] months_with_30 = ['April', 'June', 'September', 'November'] months_with_28 = ['February'] if month in months_with_31: return 31 elif month in months_with_30: return 30 elif month in months_with_28: return 28
Time is over! You can keep submitting you assignments, but they won't compute for the score of this quiz.
When you can never remember how many days each month has
Write a function that returns the number of days in a given month. (non leap years)
how_many_days_in('December') == 31 how_many_days_in('February') == 28