-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalendar
29 lines (27 loc) · 916 Bytes
/
calendar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import calendar
from datetime import datetime
def print_calendar(year, month):
"""
Выводит календарь для заданного года и месяца
"""
print(calendar.month(year, month))
def main():
"""
Основная функция приложения
"""
print("Обычный календарь")
while True:
try:
year = input("Year (or 'exit' for escape): ")
if year.lower() == 'exit':
break
year = int(year)
month = int(input("Vvedite (1-12): "))
if month < 1 or month > 12:
print("Xuy")
continue
print_calendar(year, month)
except ValueError:
print("Gondon")
if __name__ == "__main__":
main()