← Back to challenges

Days in a Month

PythonHardconditionsdates

Instructions

Create a function that takes the month and year (as integers) and returns the number of days in that month.

Examples

day_amount(2, 2018) ➞ 28

day_amount(4, 654) ➞ 30

day_amount(2, 200) ➞ 28

day_amount(2, 1000) ➞ 28

Notes

Don't forget about leap years!

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Puzzle Pieces