Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def make_grouping(self, course: Course, survey: Survey) -> Grouping:
- """
- Return a grouping for all students in <course>.
- The first group should contain the students in <course> whose names come
- first when sorted alphabetically, the second group should contain the
- next students in that order, etc.
- All groups in this grouping should have exactly self.group_size members
- except for the last group which may have fewer than self.group_size
- members if that is required to make sure all students in <course> are
- members of a group.
- Hint: the sort_students function might be useful
- """
- students = list(course.get_students())
- students_sorted = slice_list((sort_students(students, 'name')),
- self.group_size)
- final = Grouping()
- for lst in students_sorted:
- x = Group(lst)
- final.add_group(x)
- return final
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement