Example
>>> # Create a list
>>> animals = ["Giraffe", "Lion", "Horse", "Lion", "Giraffe", "Hippo", "Cow"]
>>>
>>> # Remove duplicates
>>> animals = list(dict.fromkeys(animals))
>>>
>>> # Print the list
>>> print(animals)
['Giraffe', 'Lion', 'Horse', 'Lion', 'Giraffe', 'Hippo', 'Cow']
What happened?
First, we create a list with animals. Some of those are duplicates.
Next, we create a new list, based on a dictionary we make from the list.
If we just run the "dict.fromkeys(animals)", we get this:
>>> animals = dict.fromkeys(animals)
>>> print(animals)
{'Giraffe': None, 'Lion': None, 'Horse': None, 'Hippo': None, 'Cow': None}
So here we have a dictionary with keys and values. Well, the values is None as you can see.
When we convert this to a list, the value will be removed and the key will be preserved.
The reason why the duplicates are removed is that a Python dictionary can't have duplicate keys, so they are just ignored.