CodingNeed.

4 · Build useful programs · 8 MIN

Describe a real thing

Objects group related properties.

A dictionary groups values by keys. Use square brackets with the quoted key to access a value. Missing keys raise KeyError; use get when absence is expected. An f-string can place an expression inside text.

A contact card groups a name and age into one record.

Read the example

learner = {"name": "Ada", "points": 50}
print(learner["name"])
Check the expected output
Ada

Your challenge

Return "NAME has POINTS points" using input["name"] and input["points"].

Common trap

Dictionary keys are case-sensitive.

Next lesson: Project · Expense summary →

Essential cookies keep your account signed in. Optional analytics is not configured on this site. Your choice does not affect access to lessons.

Read the Privacy Policy. You can change this choice in the footer.