Recall & Review
beginner
What is a set in Python?
A set is a collection of unique items in Python. It automatically removes duplicates and is unordered.
Click to reveal answer
beginner
Why do we use sets instead of lists when we want unique items?
Sets automatically remove duplicates and are faster for checking if an item exists compared to lists.
Click to reveal answer
beginner
How do sets help in real life? Give an example.
Sets help when you want to find unique things, like unique guests invited to a party or unique words in a book.
Click to reveal answer
intermediate
What is one advantage of sets related to speed?
Sets are faster than lists for checking if an item is present because they use a special method called hashing.
Click to reveal answer
intermediate
Can sets be used to perform mathematical operations? Name one.
Yes, sets can perform operations like union, intersection, and difference to compare groups of items.
Click to reveal answer
What happens if you add duplicate items to a Python set?
✗ Incorrect
Sets only keep unique items, so duplicates are automatically ignored.
Which of these is a key benefit of using sets over lists?
✗ Incorrect
Sets are optimized for fast membership checks, unlike lists.
Which operation can you perform with sets but not with lists?
✗ Incorrect
Sets support mathematical operations like union, which lists do not.
What type of data does a set store?
✗ Incorrect
Sets store unique items without any order.
Why might you use a set to find unique words in a sentence?
✗ Incorrect
Sets automatically remove duplicate words, making it easy to find unique words.
Explain why sets are useful when you want to store unique items.
Think about how sets handle duplicates and speed.
You got /3 concepts.
Describe a real-life situation where using a set would be better than a list.
Consider situations where duplicates are not wanted.
You got /3 concepts.