Case4. Given the month number is an integer in the range 1-12 (1 - January, 2 - February, etc.). Determine the number of days this month for a non-leap year.

Solution in Python 3:

import random

i = random.randrange(1,12)
print("Number of the month: ", i)
i = str(i)
m = {
'1': 31,
'2': 28,
'3': 31,
'4': 30,
'5': 31,
'6': 30,
'7': 31,
'8': 31,
'9': 30,
'10': 31,
'11': 30,
'12': 31
}
try:
print(m[i])
except KeyError as e:
print('Error')