Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def lstAppr(choices):
- l = []
- def intersect(l, m):
- if any([True for i in l if i in m]):
- return True
- else:
- return False
- for i in choices:
- if not intersect(l, i):
- l.append(min(i))
- else:
- if i[0] not in l:
- l.append(i[0])
- elif i[1] not in l:
- l.append(i[1])
- else:
- if l.count(i[0]) > l.count(i[1]):
- l.append(i[1])
- elif l.count(i[0]) < l.count(i[1]):
- l.append(i[0])
- else:
- l.append(min(i))
- return l
Add Comment
Please, Sign In to add comment