Python Empty Collections: Dictionary vs Set

Python Empty Collections — Common Mistake [] # List () # Tuple {} # Dictionary (NOT a set) set() # Set Trick to Remember: 👉 {} = key:value → dictionary 👉 set() = only way to make empty set Example type({}) # dict type(set()) # set If you remember just this: “Curly braces empty = dict, not set” You’ll never make this mistake again. Source: https://lnkd.in/d8sbr7gc #Python

To view or add a comment, sign in

Explore content categories