# Given grid = [[0] * 3 for _ in range(3)], set grid[1][1] = 9 and print grid

Canonical URL: <https://datadriven.io/problems/given-grid-0-3-for-in-range3-set-grid11-9-dbb8138a>

Domain: Python · Difficulty: medium

## Problem

Given grid = [[0] * 3 for _ in range(3)], set grid[1][1] = 9 and print grid. (This works because each row is a distinct list, unlike the [[0]*3]*3 shallow-copy trap.)

## Related

- [All practice problems](https://datadriven.io/problems)
- [Mock interview mode](https://datadriven.io/interview/given-grid-0-3-for-in-range3-set-grid11-9-dbb8138a)
- [Python Interview Questions](https://datadriven.io/python-interview-questions)
- [Data Engineering Interview Prep Guide](https://datadriven.io/data-engineer-interview-prep)
- [Daily Challenge](https://datadriven.io/daily)

---

Source: DataDriven (https://datadriven.io). 100% free data engineering interview prep. Live code execution against Postgres 16, Python 3.11, and Spark sandboxes. No paywall, no premium tier, no signup gate.