Answers for "python operate one element to all"

2

how to operate on all elements in a list python

oldlist = [1,2,3]
newlist = [i * 2 for i in oldlist]
print(newlist)
# >>> [2, 4, 6]
Posted by: Guest on December-12-2020

Code answers related to "python operate one element to all"

Python Answers by Framework

Browse Popular Code Answers by Language