# Using a list comprehension: l = [x * 2 for x in l] # Using a lambda function with map: l = map(lambda x: x * 2, l)
Here is what the above code is Doing:
1. Create a list of numbers from 0 to 9.
2. Multiply each number by 2 using a list comprehension.
3. Multiply each number by 2 using a lambda function with map.