I have a list:
my_list = [1, 2, 3, 4, 5]
How can I multiply each element in my_list by 5? The output should be:
my_list
With map (not as good, but another approach to the problem):
list(map(lambda x: x*5,[5, 10, 15, 20, 25]))
also, if you happen to be using numpy or numpy arrays, you could use this:
import numpy as np list(np.array(x) * 5)