A website logs visitor ids in the order they arrived; the same visitor may appear many times. Write unique_in_order(visits) that returns a new list with each id kept only the first time it appears, in order of first arrival.
Examples
Input: visits = [3, 1, 3, 2, 1]
Output: [3, 1, 2]
Input: visits = ["a", "a"]
Output: ["a"]
Constraints
0 <= len(visits) <= 5000- the number of distinct ids is small (at most 100)
Goals
- Use the in operator to test membership
- Keep the first appearance of each value