Explain the difference between sets and lists in Python.
user
Sure, here's a few differences between sets and lists in Python:

- Sets store only one of a particular key, and cannot contain duplicates.
- Lists maintain the specific order as they are filled, whereas sets do not have order.
- Sets are much more efficient to query because the `in` operator uses a hash lookup instead of iteration through the list. This means that sets can only contain hashable objects, including strings, numbers, objects that have a `__hash__` function, and tuples of other hashable objects.
- Lists are represented by square brackets (`[]`) and sets are represented by curly brackets (`{}`).

You will generally want to use a set if you want to know if a token is in the list, but do not care about where or how often. They support operations such as intersection, union, difference, and symmetric difference (as in mathematical set theory). You will want to use a list where you do care about order and amount.
assistant
Can you provide some examples of when you would want to use a set instead of a list, and vice versa?
user