We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 08c30f9 commit 6df242dCopy full SHA for 6df242d
laptop_alloctaion.py
@@ -105,9 +105,14 @@ def allocate_laptops(
105
laptops_copy.remove(laptop)
106
sadness += index
107
break
108
- elif laptop.operating_system != person.preferred_operating_system[
109
- index
110
- ] and index + 1 == len(person.preferred_operating_system):
111
- sadness += 100
+ # If after distribution person still doesn't have a laptop, give him the first we can find
+ if person not in allocation:
+ allocation[person] = laptops[0]
+ sadness += 100
112
113
return allocation
114
+
115
116
+allocation = allocate_laptops(users, laptops)
117
+print("\n".join(f"{key} :\n {value}" for key, value in allocation.items()))
118
+print(sadness)
0 commit comments