This question is related to iteration and mutability in python; The relevant lessons are

For this question, the following code will be executed by python (2.7):

for datum in data:
  datum *= 2 #equivalent to datum = datum * 2
print data

The code will be run sequentially on the following data:

i.    data = [1,2,3,4]
ii.   data = [[1,2],[3,4]]
iii.  data = [(1,2),(3,4)]

What is the output in each case?

a.
  [2,4,6,8]
  [[2,4],[6,8]]
  [(2,4),(6,8)]
b.
  [1,2,3,4]
  [[1,2],[3,4]]
  [(1,2),(3,4)]
c.
  [2,4,6,8]
  [[1,2,1,2],[3,4,3,4]]
  [(1,2,1,2),(3,4,3,4)]
d.
  [1,2,3,4]
  [[1,2,1,2],[3,4,3,4]]
  [(1,2),(3,4)]

Correct answer is d.

What is output in the following code (under the same conditions):

computed = [datum*2 for datum in data]
print data

a.
  [1,2,3,4]
  [[1,2],[3,4]]
  [(1,2),(3,4)]
b.
  [1,2,3,4]
  [[1,2],[3,4]]
  [(1,2),(3,4)]
c.
  [2,4,6,8]
  [[1,2,1,2],[3,4,3,4]]
  [(1,2,1,2),(3,4,3,4)]
d.
  [1,2,3,4]
  [[1,2,1,2],[3,4,3,4]]
  [(1,2),(3,4)]