Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. lista = [
  2. [4, 'aa'],
  3. [4, 'bb'],
  4. [4, 'cc'],
  5. [4, 'dd'],
  6. [24, 'ee'],
  7. [24, 'ff'],
  8. [25, 'gg'],
  9. [25, 'hh'],
  10. [26, 'ii'],
  11. [26, 'jj'],
  12. ]
  13.  
  14. correta = []
  15. num = []
  16. for item in lista:
  17. if item[0] not in num:
  18. num.append(item[0])
  19. item.append(True)
  20. correta.append(item)
  21. else:
  22. item.append(False)
  23. # correta.append(item)
  24.  
  25. print(correta)
  26. # [[4, 'aa', True], [24, 'ee', True], [25, 'gg', True], [26, 'ii', True]]
  27.  
  28. print(lista)
  29. # [[4, 'aa', True],
  30. # [4, 'bb', False],
  31. # [4, 'cc', False],
  32. # [4, 'dd', False],
  33. # [24, 'ee', True],
  34. # [24, 'ff', False],
  35. # [25, 'gg', True],
  36. # [25, 'hh', False],
  37. # [26, 'ii', True],
  38. # [26, 'jj', False]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement