Transform a list
Take your time, follow the code and check your understanding.
Move blocks into orderLists
print(doubled)
doubled.append(value * 2)
for value in values:
doubled = []
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)