logo CodeStepByStep logo

get_days_in_month

Language/Type: Python if/else parameters return

Write a function named get_days_in_month that accepts an integer parameter representing a month (between 1 and 12) and returns the number of days in that month in a non-leap year. For example, the call get_days_in_month(9) would return 30 because September has 30 days.

Month 1 Jan 2 Feb 3 Mar 4 Apr 5 May 6 Jun 7 Jul 8 Aug 9 Sep 10 Oct 11 Nov 12 Dec
Days 31 28 31 30 31 30 31 31 30 31 30 31
Function: Write a Python function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.