Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lista = [
- [4, 'aa'],
- [4, 'bb'],
- [4, 'cc'],
- [4, 'dd'],
- [24, 'ee'],
- [24, 'ff'],
- [25, 'gg'],
- [25, 'hh'],
- [26, 'ii'],
- [26, 'jj'],
- ]
- correta = []
- num = []
- for item in lista:
- if item[0] not in num:
- num.append(item[0])
- item.append(True)
- correta.append(item)
- else:
- item.append(False)
- # correta.append(item)
- print(correta)
- # [[4, 'aa', True], [24, 'ee', True], [25, 'gg', True], [26, 'ii', True]]
- print(lista)
- # [[4, 'aa', True],
- # [4, 'bb', False],
- # [4, 'cc', False],
- # [4, 'dd', False],
- # [24, 'ee', True],
- # [24, 'ff', False],
- # [25, 'gg', True],
- # [25, 'hh', False],
- # [26, 'ii', True],
- # [26, 'jj', False]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement