lst = [1, 3, 2, 1, 3, True, False, True, "apple", "banana", "mango", "apple"]
lst2 = []
for i in range(0, len(lst)):
if lst[i] not in lst2:
lst2.append(lst[i])
print(lst2)
Above code is to remove duplicate values. But it is also removing True
value. Anyone Explain me why it's not storing True
value and show me correct code.
Desired Output:
[1,3,2, True, False, “apple”, “banana”, “mango”]
Output I'm getting:
[1,3,2, False, “apple”, “banana”, “mango”]
Can anyone help me with this and explain me reason behind it. Please it would be really helpful.