Python Programming - Lists - Discussion

Discussion Forum : Lists - General Questions (Q.No. 10)
10.
What is the correct way to create a new list by multiplying each element of an existing list by 2 in Python?
new_list = list * 2
new_list = [element * 2 for element in old_list]
new_list = old_list.multiply(2)
new_list = old_list * 2
Answer: Option
Explanation:
The correct way to create a new list by multiplying each element of an existing list by 2 is using a list comprehension as shown in option B.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.