forked from pablorus/Python_lessons_basic
-
Notifications
You must be signed in to change notification settings - Fork 447
Expand file tree
/
Copy pathlesson_2.3.py
More file actions
24 lines (23 loc) · 999 Bytes
/
lesson_2.3.py
File metadata and controls
24 lines (23 loc) · 999 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
'''
Пользователь вводит месяц в виде целого числа от 1 до 12.
Сообщить к какому времени года относится месяц (зима, весна,
лето, осень).
Напишите решения через list и через dict.
'''
seasons_list = ['winter', 'spring', 'summer', 'autumn']
seasons_dict = {1 : 'winter', 2 : 'spring', 3 : 'summer', 4 : 'autumn'}
month = int(input("Введите месяц по номеру "))
if month ==1 or month == 12 or month == 2:
print(seasons_dict.get(1))
print(seasons_list[0])
elif month == 3 or month == 4 or month ==5:
print(seasons_dict.get(2))
print(seasons_list[1])
elif month == 6 or month == 7 or month == 8:
print(seasons_dict.get(3))
print(seasons_list[2])
elif month == 9 or month == 10 or month == 11:
print(seasons_dict.get(4))
print(seasons_list[3])
else:
print("Такого месяца не существует")