-
Notifications
You must be signed in to change notification settings - Fork 0
/
week.py
executable file
·38 lines (26 loc) · 1.14 KB
/
week.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
#!/usr/bin/env python3
import os
def main():
week = int(input("Week: "))
problems = int(input("Amount of problems: "))
optional = int(input("Amount of optional problems: "))
assignments = int(input("Amount of assignments: "))
basecamp_directory = os.path.dirname(os.path.abspath(__file__))
week_directory = os.path.join(basecamp_directory, f"Week{week}")
os.makedirs(week_directory, exist_ok=True)
def create_directory_with_file(directory: str):
if os.path.isdir(directory): return
os.makedirs(directory)
file = os.path.join(directory, "main.py")
open(file, "x")
for i in range(problems):
problem_directory = os.path.join(week_directory, f"Problem{i + 1}")
create_directory_with_file(problem_directory)
for i in range(optional):
optional_directory = os.path.join(week_directory, f"Optional{i + 1}")
create_directory_with_file(optional_directory)
for i in range(assignments):
assignment_directory = os.path.join(week_directory, f"Assignment{i + 1}")
create_directory_with_file(assignment_directory)
if __name__ == "__main__":
main()