Days in a Month

Published by Pickle in

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

Examples

Days(2, 2018) ➞ 28

Days(4, 654) ➞ 30

Days(2, 200) ➞ 29

Days(2, 1000) ➞ 29

Notes

  • Don't forget about leap years!
  • Although you can create the algorithm to determine the leap-year number for February, there is a library function that can really help.
Watch a quick demo on how Edabit works.