From f59d52577f13e5a22a152fee249e7bf87d384e0f Mon Sep 17 00:00:00 2001 From: xenofem Date: Thu, 9 Jul 2020 19:31:56 -0400 Subject: [PATCH] fix type errors --- waggle-dance.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/waggle-dance.py b/waggle-dance.py index 6e24925..c958197 100755 --- a/waggle-dance.py +++ b/waggle-dance.py @@ -64,9 +64,8 @@ def matchings(l): for i in range(count // 2): if len(disjoint_pairs) != 0: p = disjoint_pairs.pop() + [u0, u1] = [u for u in l if u.id in p] l = [u for u in l if u.id not in p] - u0 = p[0] - u1 = p[1] else: u0 = l.pop() u1 = l.pop() @@ -87,7 +86,7 @@ def matchings(l): random.shuffle(result) for i in range(len(result)): random.shuffle(result[i]) - for j in len(result[i]): + for j in range(len(result[i])): if random.randrange(2) == 0: result[i][j] = (result[i][j][1], result[i][j][0]) result = [matching for matching in result if all((min(match[0].id,match[1].id), max(match[0].id,match[1].id)) not in block_pairs for match in matching)]