Case3. The month number is given as an integer in the range 1-12 (1 - January, 2 - February, etc.). Output the name of the corresponding time of the year ("winter", "spring", "summer", "autumn").

Solution in Python 3:

import random

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