Spot the bug Python
1
# Build the weekend schedule from the standard template.
2
template = [["open", "close"], ["inventory"], ["payroll"]]
3
weekend = template.copy()
4
weekend.append(["deep-clean"])
5
weekend[0].append("stocktake")6
counts = {i: len(day) for i, day in enumerate(template)}7
print(counts)
8
# expected: {0: 2, 1: 1, 2: 1}9
# actual: {0: 3, 1: 1, 2: 1} (!)