How is [[1, 1]] * 5 different from [[1, 1] for _ in range(5)] in Python? [duplicate]

  python

I had the idea that both the way provide the same output and I checked that by printing arr in both cases.
But as it turns out, I get different results. Please explain.

Source: Python Questions

LEAVE A COMMENT