• break-rings


I would like to give some feedback about ...

From: https://checkio.org/mission/break-rings/solve/


Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36

Error in this task, because my code works on my computer well and return right result

Code: def break_rings(rings): itog = set() ident = [i.copy() for i in rings] for pair in rings: for ring in pair: if ring not in itog: for ringss in rings[rings.index(pair)+1:]: if ring in ringss and len(ident[rings.index(pair)]) == len(pair) == 2: itog.add(ring) for i in ident: i.discard(ring) break for j in ident: if len(j)==2: for thik in j: if thik in itog: break x = j.pop() itog.add(x) return len(itog)