Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Set basics
3. Defining empty sets
Relationships between sets
Summary

Instruction

Good job! Defining an empty set is a special case. Take a look:

not_a_set = {}
print(type(not_a_set))

The code above prints <class 'dict'>.

This is because an empty pair of curly brackets creates a dictionary, not a set. To create an empty set, use the following code:

real_set = set()
print(type(real_set))

This time, we'll get <class 'set'>.

Exercise

Run the template code and see the difference in type for yourself.