There is no need to multiply each element by 2; just multiply the whole sum by 2 afterwards.
>>> data = [9, 4, 5]
>>> 2 * sum(data)
36
2
solved Python performing calculation in a list
There is no need to multiply each element by 2; just multiply the whole sum by 2 afterwards.
>>> data = [9, 4, 5]
>>> 2 * sum(data)
36
2
solved Python performing calculation in a list