For example in the below list
l=[1, 2, 3, 'hello', "world", True, 10, 1, 2, 3, 'hello', True, 10, 1, 2, 3, 'hello', True] ,
I'm not able to retain the occurrence of the keyword True. I have used different methods like for loop to iterate over each elements in the list and appending it to the new list if doesn't exists in the new list(naive method), list comprehension, built in function like set().
I'm getting the below output which is incorrect !!
[1, 2, 3, 'hello', 'world', 10]
please assist me to solve this issue
The code that I have written
ll=[]
for i in l :
if i not in ll :
ll.append(i)
print(ll)
output I'm getting = [1, 2, 3, 'hello', 'world', 10] expected output = [1, 2, 3, 'hello', 'world', True, 10]