Interview Question

What are sets?

Sets store unique hashable values.

💡 Concept ✅ Quick Revision 🐍 Python

Answer

A set is an unordered collection of distinct hashable objects. • Duplicate equal values are stored once. • Sets support membership tests and mathematical set operations. • An empty set is created with set(), not {}.

💡 Simple Example

values = {1, 2, 2, 3} print(len(values))

Output

3

⚡ Quick Revision

Sets store unique hashable values.