PYTHON CORE · LESSON 33
New list quickly
List generator · about 13 minutes
Learning with progressRead the summary for free. To save the work, log in to the account.
Type the code yourself
Reprint a short way to create a new list.
nums = [2, 4]
doubled = [n * 2 for n in nums]
print(doubled)Open the editor for class workSolve it yourself
Create numbers = [1, 2, 3]. Using a list generator, create a doubled, where each number is multiplied by 2, and output doubled.
The answer is hidden. Use similar examples from the lesson notes.
Opening up your homework