point = (4, 7)Line-by-line explanation
- Round brackets create this tuple.
- The tuple contains two integers.
pointstores the pair.
Tuple indexing works like list indexing:
x = point[0]Line-by-line explanation
- Index 0 selects the first item.
xstores4.
Tiny Practice
Read the second coordinate.
Starter template
point = (4, 7)
y = CHANGE_MELine-by-line explanation
- The tuple has two positions.
- The second position has index 1.
Hint
- Use
point. - Use square brackets for lookup.
- Put 1 inside.
Show Solution
point = (4, 7)
y = point[1]Line-by-line explanation
- The tuple is created.
- Index 1 selects 7.
ystores 7.