Guest User

Untitled

a guest
May 23rd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. def lstAppr(choices):
  2. l = []
  3. def intersect(l, m):
  4. if any([True for i in l if i in m]):
  5. return True
  6. else:
  7. return False
  8. for i in choices:
  9. if not intersect(l, i):
  10. l.append(min(i))
  11. else:
  12. if i[0] not in l:
  13. l.append(i[0])
  14. elif i[1] not in l:
  15. l.append(i[1])
  16. else:
  17. if l.count(i[0]) > l.count(i[1]):
  18. l.append(i[1])
  19. elif l.count(i[0]) < l.count(i[1]):
  20. l.append(i[0])
  21. else:
  22. l.append(min(i))
  23. return l
Add Comment
Please, Sign In to add comment