uaveiro-leci/1ano/fp/extra3/ex10.py

11 lines
220 B
Python
Raw Normal View History

2023-01-10 10:45:45 +00:00
def unload(t, m, q):
for v in t[::-1]:
if v[0] != m:
continue
while v[1] > 0 and q > 0:
v[1] -= 1
q -= 1
if v[1] == 0:
t.remove(v)
return q