Bummer! This is just a preview. You need to be signed in with an account to view the entire instruction.

Well done!

You have completed (UPI) Chapter 12: Mastering Python Dictionaries!

Instruction

Dictionary Creation

Two methods exist for creating an empty dictionary:

  1. Using curly braces {}.
    • Example: dict_1 = {}.
  2. Using the dict() function.
    • Example: dict_2 = dict().

A dictionary object can also be created with initial key-value pairs enclosed in curly braces.

  • Example: my_dict = {"pizza": 2, "pasta": 3, "drink": 4} creates a dictionary object my_dict. A key...