CHAPTER 36   •   PYTHON

Python Dictionaries

Learn key-value data structures.

01 What is this?

Learn key-value data structures.

02 Syntax

Python Syntax
data = {'key': 'value'}

03 Example

Python Example
student = {
    'name': 'AIFA',
    'age': 20
}

print(student['name'])

04 Important Points

Dictionaries store data using keys and values.

05 Common Mistakes

Accessing a missing key can cause an error.

06 Real World Use

Dictionaries are heavily used for structured application data.

07 Practice This Topic

Now try the example yourself in the AIFA Python Editor.

  • Read the example carefully.
  • Change the values.
  • Run the code.
  • Observe the output.
  • Try creating your own example.
Try It Yourself →