What does `len({‘a’: 1, ‘b’: 2, ‘c’: 3})` return?

Python Developer Easy

Python Developer — Easy

What does `len({‘a’: 1, ‘b’: 2, ‘c’: 3})` return?

Key points

  • The `len()` function counts the number of items in a data structure
  • Dictionaries in Python are unordered collections of key-value pairs
  • Each key-value pair in the dictionary counts as one item

Ready to go further?

Related questions