Skip to content

Commit f3e5a23

Browse files
Merge pull request #304 from Rkssh/py_project
Python calendar project
2 parents 29d1128 + 3bc3bc0 commit f3e5a23

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

week/Readme.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
# Animated Calendar
3+
This Python script animates a calendar for the given year and month.
4+
## Requirements
5+
* Python 3
6+
* The `calendar` and `time` modules
7+
## Installation
8+
To install the required modules, you can run the following command in the command line:
9+
pip install calendar time
10+
11+
## Usage
12+
To run the script, you can save it as a Python file and then run it from the command line. For example, if you saved the script as `calendar.py`, you could run it by typing the following command into the command line:
13+
python3 calendar.py
14+
15+
This will animate the calendar for the current year and month.
16+
## Example
17+
The following is an example of the output of the script:
18+
Mon
19+
Tue
20+
Wed
21+
Thr
22+
Fri
23+
Sat
24+
Sun
25+
26+
The calendar will be displayed one day at a time, with a 1 second delay between each day.
27+
28+

week/week.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import calendar
2+
import time
3+
4+
def animate_calendar(year, month):
5+
"""Animates a calendar for the given year and month."""
6+
for day in range(1, calendar.monthrange(year, month)[1] + 1):
7+
print(calendar.day_abbr[calendar.weekday(year, month, day)])
8+
time.sleep(1)
9+
10+
if __name__ == "__main__":
11+
year = 2023
12+
month = 7
13+
animate_calendar(year, month)

0 commit comments

Comments
 (0)