← Python Programming
Collections and functions · 15 MIN

Tuples, sets and dictionaries

Tuples, sets and dictionaries

Tuples are immutable sequences. Sets hold unique hashable items and support set operations. Dictionaries map keys to values and are useful for records and lookup tables. Choose a structure based on how you need to access and update data.

Try it yourself

Change the example, run it, and explain the result in your own words. Then create one variation of your own.

Key idea

Use the example as a starting point, not something to memorize. Practise, inspect the result and make small improvements.

Code example

student = {"name": "Tomi", "score": 88}
unique_tags = {"python", "web", "python"}
point = (4, 7)
print(student["name"], unique_tags, point)