-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalendar.py
More file actions
62 lines (52 loc) · 1.64 KB
/
Calendar.py
File metadata and controls
62 lines (52 loc) · 1.64 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#Calendar by Joon Hao, built in Visual Studio code, with Python 3
#import
import calendar, time
#intro
print("Welcome to Calendar")
print()
print()
#start
while True:
user_choice = input("Enter 'quit' to exit programme\nEnter 'fun fact' to find out if it is a leap year!\nEnter 'year' to see calendar for the year\nEnter 'month to see calendar for the month\n:")
#fun fact
if user_choice == "fun fact" or user_choice == "Fun fact" or user_choice == "Fun Fact":
print()
print()
year = input("Year for fun fact: ")
is_leap = calendar.isleap(int(year))
#not leap
if is_leap == "false":
print()
print(year + " is not a leap year")
print()
print()
#leap
else:
print()
print(year + " is a leap year!")
print()
print()
#see year calendar
elif user_choice == "year" or user_choice == "Year":
print()
print()
year = input("Year: ")
print()
print(calendar.calendar(int(year)))
#see month calendar
elif user_choice == "month" or user_choice == "Month":
print()
print()
year = input("Year: ")
month = input("Month (in number): ")
print()
print(calendar.month(int(year), int(month)))
#user quit programme
elif user_choice == "quit" or user_choice == "Quit":
print("Closing programme...")
time.sleep(2)
print("Good bye!")
break
#unknown user input
else:
print("Unknown input. please try again")