This commit is contained in:
Trygve 2024-10-01 14:15:03 +02:00
parent 16ced51fa8
commit bb9f20981a

24
uke4.py Normal file
View File

@ -0,0 +1,24 @@
from pathlib import Path
def generate_exercise_list(project_assignments_start, total_exercises):
return [str(i) for i in range(1, project_assignments_start)] + [f'{i}{part}' for i in range(project_assignments_start, total_exercises + 1) for part in ['a', 'b']]
def create_directories(directory, exercises, students):
parent_directory = Path.cwd() / directory
for exercise in exercises:
exercise_path = parent_directory / Path('exercise_' + exercise)
for student in students:
student_path = exercise_path / student
studentstudent_path.mkdir(parents=True, exist_ok=True)
for directory in parent_directory.glob('**/*'):
print(directory)
def main():
exercises = generate_exercise_list(5, 12)
students = ['Ole', 'Sarah', 'Ferdinand', 'Mattis']
create_directories('projects', exercises, students)
if __name__ == '__main__':
main()