Keys and values
In this dictionary, what is "apples" called?
Start activityTopics / Dictionaries
Key–value lookup and updating associated data.
Models frequently confuse membership of keys with membership of values. That is an evaluation opportunity, not a reason to skip the concept.
In this dictionary, what is "apples" called?
Start activityIn your own words, what is a dictionary in Python, and how is it different from a list?
Start activityMatch each term to the definition that fits it. The code is there so you can see what each term refers to; …
Start activityWhat overall problem is this program solving? Avoid describing only the syntax.
Start activityExplain in plain English what this code does. Say what the dictionary holds, what the second line changes, and what is printed.
Start activityThe program should print each item with its price, as 'tea 2' and then 'cake 4'. Which expression completes the blank?
Start activityTwo AI-generated programs both try to tally votes into a dictionary. Each is a separate program. Compare them. Which statement is true?
Start activityAn AI produced the function below for: return the stock count for a product name, or 0 if the product is missing. …
Start activityRequirement: total_stock(stock) returns the total number of items in stock, where stock maps product names to counts (for example {'apples': 5, 'pears': …
Start activity