Learn with Yasir

Share Your Feedback

Python Dictionaries Fill in the Blanks – Interactive Exercises for Beginners

Practice and master Python dictionaries with interactive fill-in-the-blanks exercises. Strengthen your understanding of key-value pairs, dictionary methods, and data manipulation. Ideal for beginners and students learning Python.

Topic: dictionaries


🔍 Fill in the Blanks

🟢 Beginner

  1. A Python dictionary stores data in ______ pairs.
  2. Answer

    key-value

    Dictionaries store data as key-value pairs where each key maps to a value.


  3. To create an empty dictionary, you use ______.
  4. Answer

    {}

    You can create an empty dictionary using curly braces {} or the dict() constructor.


  5. To access a value in a dictionary, you use its ______.
  6. Answer

    key

    Values are accessed by using their keys inside square brackets: dict[key].


  7. To add a new key-value pair, use the ______ brackets.
  8. Answer

    square

    Use square brackets to assign a value to a new or existing key: dict[key] = value.


  9. The ______ method returns all keys in a dictionary.
  10. Answer

    keys()

    The keys() method returns a view object of all keys in the dictionary.


  11. The ______ method returns all values in a dictionary.
  12. Answer

    values()

    The values() method returns a view object of all values in the dictionary.


  13. The ______ method removes a key and returns its value.
  14. Answer

    pop()

    The pop() method removes the specified key and returns its value.


  15. To get a list of key-value pairs, use the ______ method.
  16. Answer

    items()

    The items() method returns a view object with the dictionary’s key-value pairs.


  17. To check if a key exists, use the ______ operator.
  18. Answer

    in

    Use 'in' to check if a key exists: 'key' in dict.


  19. Dictionaries in Python are ______, meaning their keys must be unique.
  20. Answer

    unordered and unique-keyed

    Python dictionaries are unordered collections and do not allow duplicate keys.


🟡 Intermediate

🔴 Advanced



📚 Related Resources

🧠 Practice & Progress

Explore More Topics

📘 Learn Python

Tutorials, Roadmaps, Bootcamps & Visualization Projects

Python Fundamentals

Flow Control Statements


Python Functions


Fundamentals more ...




🧠 Python Advanced

Object-Oriented Programming in Python (OOP)

More...

🧠 Modules