Transform a list

Take your time, follow the code and check your understanding.

Move blocks into orderLists
  1. print(doubled)
  2.     doubled.append(value * 2)
  3. for value in values:
  4. doubled = []
  5. values = [1, 2, 3]
Your answer3 min · no timer

Drag blocks, or use the arrow buttons. Keep the displayed indentation. This task uses the taught sequence; other equivalent programs may also be valid.

Show solution and explanation

The input and result lists must exist before the loop. Print after the loop ends.

values = [1, 2, 3]
doubled = []
for value in values:
    doubled.append(value * 2)
print(doubled)