diff --git a/1ano/1semestre/fp/aula08/interests.py b/1ano/1semestre/fp/aula08/interests.py index a727ff6..e7676d4 100644 --- a/1ano/1semestre/fp/aula08/interests.py +++ b/1ano/1semestre/fp/aula08/interests.py @@ -21,7 +21,7 @@ def main(): print("a) Table of common interests:") commoninterests = {(p1, p2): interests[p1].intersection(interests[p2]) for p1 in interests for p2 in interests - if p1 != p2 and list(interests.keys()).index(p1) < list(interests.keys()).index(p2)} + if list(interests.keys()).index(p1) < list(interests.keys()).index(p2)} print(commoninterests) print("b) Maximum number of common interests:") diff --git a/1ano/1semestre/fp/extra3/ex10.py b/1ano/1semestre/fp/extra3/ex10.py index e6017a3..b5f7f35 100644 --- a/1ano/1semestre/fp/extra3/ex10.py +++ b/1ano/1semestre/fp/extra3/ex10.py @@ -20,11 +20,12 @@ 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: + if v[1] <= q: + q -= v[1] t.remove(v) + else: + v[1] -= q + q = 0 return q