Second solution in Uncategorized category for New Cities by vvm70
def subnetworks(net, crushes):
nodes = list(filter(len, ([x for x in node if x not in crushes] for node in net)))
s = 
for node in nodes:
if s[-1] & set(node):
s[-1] |= set(node)
nodes = [x for x in nodes if not (set(x) & s[-1])]
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
], ['B']) == 2, "First"
], ['A']) == 3, "Second"
], ['C', 'D']) == 1, "Third"
print('Done! Check button is waiting for you!')
Oct. 24, 2020