python perform operation on list code example
Example: 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]
oldlist = [1,2,3]
newlist = [i * 2 for i in oldlist]
print(newlist)
# >>> [2, 4, 6]