Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
From the list , make a new list that has each value only once, in the order of the first appearance: .
Use not in to test if a value is missing from a list.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, compare your working with the solution.
Plan. Start with an empty list, unique. Go through the numbers. If a number is not in unique yet, append it.
[]: [3].[3]: [3, 1].[3, 1, 2].Answer: [3, 1, 2].
Log in to join the discussion.
Loading…