-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdays.py
69 lines (53 loc) · 1.61 KB
/
days.py
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
63
64
65
66
67
68
69
# script prints all days that has been solved by myself
# constants
FIRST_YEAR = 2015
LAST_YEAR = 2021
FIRST_DAY = 1
LAST_DAY = 25
# spaces
YEAR_INDENTATION = " " * 4
DAY_INDENTATION = " " * 8
# days
COMPLETED_DAYS = {
2020: {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
},
2021: {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
},
}
def create_days_dictionary():
days = {}
for year in range(FIRST_YEAR, LAST_YEAR+1):
days[year] = {}
for day in range(FIRST_DAY, LAST_DAY+1):
days[year][day] = False
return days
def update_by_completed_days(days):
for year in COMPLETED_DAYS:
for day in COMPLETED_DAYS[year]:
days[year][day] = True
def get_text_to_print(days):
text_to_print = ""
last_year = None
line_breaks = 0
for year in days:
for day in days[year]:
if days[year][day]:
if year != last_year:
last_year = year
text_to_print += f"\n\n{YEAR_INDENTATION}-> {last_year}\n{DAY_INDENTATION}> "
if day > 10 and line_breaks < 1:
line_breaks += 1
text_to_print += f"\n{DAY_INDENTATION}> "
elif day > 20 and line_breaks < 2:
line_breaks += 1
text_to_print += f"\n{DAY_INDENTATION}> "
text_to_print += f"{day:>2} | "
return text_to_print + "\n"
def main():
days = create_days_dictionary()
update_by_completed_days(days)
print(get_text_to_print(days))
if __name__ == "__main__":
main()