Sep-01-2017, 05:13 PM
Thank Larzi, I feel we are so close.
Do you have any idea why it's only printing: "assignments: []"
i Believe i probably changed something in the code that i shouldn't have but i can't figure it out ...
I tried to put it in multiple places within the code, it never returns an error, sometimes it does print, sometimes it says Process Finished with exit code 0
...
Do you have any idea why it's only printing: "assignments: []"
i Believe i probably changed something in the code that i shouldn't have but i can't figure it out ...
I tried to put it in multiple places within the code, it never returns an error, sometimes it does print, sometimes it says Process Finished with exit code 0
...
from collections import OrderedDict preferences = OrderedDict([('Jean', (1, 2, 3, 4, 5)), ('Claude', (1, 2, 3, 4, 5)), ('Van', (1, 2, 3, 4, 5)), ('Kung', (1, 2, 3, 4, 5)), ('Fu', (1, 2, 3, 4, 5)), ('Panda', (1, 2, 3, 4, 5)), ('To',(1, 2, 3, 4, 5)), ('Much', (1, 2, 3, 4, 5)), ('Absolver', (1, 2, 3, 4, 5))]) weeks = [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, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52] tracking = {week_num: 0 for week_num in weeks} assignments = [ ] for preferences in [ ]: assignments.append([ ]) print('assignments: {}'.format(assignments)) for week_num in preferences: if tracking[week_num] < 3: assignments[-1].append(week_num) tracking[week_num] += 1 if len(assignments[-1]) == 2: break