Okay, I am thinking my way through this problem as I write out the question. Each semester I need to find a way to sort 5-20 tests being given to 5-20 students into four available days we have for giving tests. My job is to try to pack all the tests of the same kind into a single day, if possible, while also making sure that no student is assigned to take two tests on the same day.
The list I get looks like this, where S is a student and T is the test they wish to take:
S1:T1
S1:T2
S2:T1
S2:T3
S2:T4
S3:T1
S3:T2
S4:T3
S5:T2
S5:T3
etc.
What I want to be able to do is sort all T2 onto a given day -- A, B, C, D -- and to make sure that a student, like S5 above -- isn't also taking another test that day.
I know this is a common enough problem that there are extant solutions from which I could model my own, but I don't know how to call it ... and so I have no search fu.
I know I can put these values into a dictionary, and I know I can sort by key or value, but I don't know how to consolidate one value and then distribute the other, such that T1 and T4 are given on Day A, and T2 is given on Day B.
I know a query should have sample code -- e.g., sorting a dictionary by a key or value -- but I have no clue what to do next.