Convert Number to Corresponding Month Name

Published by Matt in

Create a function that takes a number (from 1 to 12) and returns its corresponding month name as a string. For example, if you're given 3 as input, your function should return "March", because March is the 3rd month.

NumberMonth Name
1January
2February
3March
4April
5May
6June
7July
8August
9September
10October
11November
12December

Examples

month_name(3) ➞ "March"

month_name(12) ➞ "December"

month_name(6) ➞ "June"

Notes

  • You can expect only integers ranging from 1 to 12 as test input.
  • If you get stuck on a challenge, find help in the Resources tab.
  • If you're really stuck, unlock solutions in the Solutions tab.
Watch a quick demo on how Edabit works.