What I just want to achieve is to be able to get a list with elemnts that aren't repeating
<current state>
results = ["Anna","Michael","Anna","Juliet","Juliet", "Anna"]
<expectation>
results=["Anna","Michael", "Juliet"]
The following will remove duplicates.
results = ["Anna","Michael","Anna","Juliet","Juliet", "Anna"]
results = list(dict.fromkeys(results))
print(results)
Output:
['Anna', 'Michael', 'Juliet']
See https://www.w3schools.com/python/python_howto_remove_duplicates.asp for more information.
You can conver the list to a set, which has no duplicates by definition.
results = set(["Anna","Michael","Anna","Juliet","Juliet", "Anna"])
If you need the type of the result to be a list, you can simply convert it back:
results = list(set(["Anna","Michael","Anna","Juliet","Juliet", "Anna"]))