INF201/uke4.py

24 lines
914 B
Python
Raw Normal View History

2024-10-01 12:15:03 +00:00
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()