#59EasyLists & Tuples· List Operations
List Operations: Remove Duplicates Preserving Order
Input format
`items`: a list of integers and/or strings.
Output format
A list with the duplicates removed.
Examples
Input: items = [3,1,3,2,1]
Output: [3,1,2]
The second 3 and the second 1 are dropped; the first occurrences keep their order.
Input: items = ["b","a","b","1",1]
Output: ["b","a","1",1]
The string "1" and the number 1 are different values.
Constraints
- 0 <= len(items) <= 10^5
- Integers and strings are never equal to each other (1 and "1" are different values)
Study first
- #python
- #lists
- #sets
- #deduplication
