-
Notifications
You must be signed in to change notification settings - Fork 0
/
output.py
29 lines (22 loc) · 807 Bytes
/
output.py
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
# allocation : list of allocation of pizzas
# allocation[0] is a list of pizzas allocated to the 2teams
# allocation[1] is a list of pizzas allocated to the 3teams
# allocation[2] is a list of pizzas allocated to the 4teams
def write_allocation_to_file(allocation, filename) :
D = len(allocation[0]) / 2 + len(allocation[1]) / 3 + len(allocation[2]) / 4
file = open(filename, "w")
file.write(str(int(D)))
file.write("\n")
file.write("2")
for pizza in allocation[0] :
file.write(" " + str(pizza))
file.write("\n")
file.write("3")
for pizza in allocation[1] :
file.write(" " + str(pizza))
file.write("\n")
file.write("4")
for pizza in allocation[2] :
file.write(" " + str(pizza))
file.write("\n")
file.close()