Quiz on Python Loop Sets



1. What is a set in Python?
2. Which loop can be used to iterate over a set in Python?
3. What will happen if you try to add a duplicate item to a set?
4. How do you create a set in Python?
5. Which of the following methods can be used to add an element to a set?
6. What will be the output of the expression len({1, 2, 3, 4})?

Advertisements