Sometimes a simple list isn't enough. When data has labeled properties, we need Dictionaries.
A Dictionary in Python is a collection of key-value pairs. Think of it like a real dictionary: you look up a word (the key) to find its definition (the value).
Dictionaries use curly braces {} and colons : to separate keys and values.
To access a value, you use square brackets with the key name instead of an index number.
Dictionaries are perfect for representing structured data, like rows in a dataset or nested relationships like a confusion matrix.
A core concept in Natural Language Processing (NLP) is counting how often words appear in text. Let's do that with a dictionary!
words = ["AI", "is", "fun", "AI", "is", "cool"].word_counts = {}.for loop to iterate over the words list.word_counts, add 1 to its value. Otherwise, add the word as a new key with the value 1.