You can just use a list comprehension:

my_list = [1, 2, 3, 4, 5]
my_new_list = [i * 5 for i in my_list]

>>> print(my_new_list)
[5, 10, 15, 20, 25]

Note that a list comprehension is generally a more efficient way to do a for loop:

my_new_list = []
for i in my_list:
    my_new_list.append(i * 5)

>>> print(my_new_list)
[5, 10, 15, 20, 25]

As an alternative, here is a solution using the popular Pandas package:

import pandas as pd

s = pd.Series(my_list)

>>> s * 5
0     5
1    10
2    15
3    20
4    25
dtype: int64

Or, if you just want the list:

>>> (s * 5).tolist()
[5, 10, 15, 20, 25]

Finally, one could use map, although this is generally frowned upon.

my_new_list = map(lambda x: x * 5, my_list)

Using map, however, is generally less efficient. Per a comment from ShadowRanger on a deleted answer to this question:

The reason "no one" uses it is that, in general, it's a performance pessimization. The only time it's worth considering map in CPython is if you're using a built-in function implemented in C as the mapping function; otherwise, map is going to run equal to or slower than the more Pythonic listcomp or genexpr (which are also more explicit about whether they're lazy generators or eager list creators; on Py3, your code wouldn't work without wrapping the map call in list). If you're using map with a lambda function, stop, you're doing it wrong.

And another one of his comments posted to this reply:

Please don't teach people to use map with lambda; the instant you need a lambda, you'd have been better off with a list comprehension or generator expression. If you're clever, you can make map work without lambdas a lot, e.g. in this case, map((5).__mul__, my_list), although in this particular case, thanks to some optimizations in the byte code interpreter for simple int math, [x * 5 for x in my_list] is faster, as well as being more Pythonic and simpler.

Answer from Alexander on Stack Overflow
Top answer
1 of 10
203

You can just use a list comprehension:

my_list = [1, 2, 3, 4, 5]
my_new_list = [i * 5 for i in my_list]

>>> print(my_new_list)
[5, 10, 15, 20, 25]

Note that a list comprehension is generally a more efficient way to do a for loop:

my_new_list = []
for i in my_list:
    my_new_list.append(i * 5)

>>> print(my_new_list)
[5, 10, 15, 20, 25]

As an alternative, here is a solution using the popular Pandas package:

import pandas as pd

s = pd.Series(my_list)

>>> s * 5
0     5
1    10
2    15
3    20
4    25
dtype: int64

Or, if you just want the list:

>>> (s * 5).tolist()
[5, 10, 15, 20, 25]

Finally, one could use map, although this is generally frowned upon.

my_new_list = map(lambda x: x * 5, my_list)

Using map, however, is generally less efficient. Per a comment from ShadowRanger on a deleted answer to this question:

The reason "no one" uses it is that, in general, it's a performance pessimization. The only time it's worth considering map in CPython is if you're using a built-in function implemented in C as the mapping function; otherwise, map is going to run equal to or slower than the more Pythonic listcomp or genexpr (which are also more explicit about whether they're lazy generators or eager list creators; on Py3, your code wouldn't work without wrapping the map call in list). If you're using map with a lambda function, stop, you're doing it wrong.

And another one of his comments posted to this reply:

Please don't teach people to use map with lambda; the instant you need a lambda, you'd have been better off with a list comprehension or generator expression. If you're clever, you can make map work without lambdas a lot, e.g. in this case, map((5).__mul__, my_list), although in this particular case, thanks to some optimizations in the byte code interpreter for simple int math, [x * 5 for x in my_list] is faster, as well as being more Pythonic and simpler.

2 of 10
39

A blazingly faster approach is to do the multiplication in a vectorized manner instead of looping over the list. Numpy has already provided a very simply and handy way for this that you can use.

>>> import numpy as np
>>> 
>>> my_list = np.array([1, 2, 3, 4, 5])
>>> 
>>> my_list * 5
array([ 5, 10, 15, 20, 25])

Note that this doesn't work with Python's native lists. If you multiply a number with a list it will repeat the items of the as the size of that number.

In [15]: my_list *= 1000

In [16]: len(my_list)
Out[16]: 5000

If you want a pure Python-based approach using a list comprehension is basically the most Pythonic way to go.

In [6]: my_list = [1, 2, 3, 4, 5]

In [7]: [5 * i for i in my_list]
Out[7]: [5, 10, 15, 20, 25]

Beside list comprehension, as a pure functional approach, you can also use built-in map() function as following:

In [10]: list(map((5).__mul__, my_list))
Out[10]: [5, 10, 15, 20, 25]

This code passes all the items within the my_list to 5's __mul__ method and returns an iterator-like object (in python-3.x). You can then convert the iterator to list using list() built in function (in Python-2.x you don't need that because map return a list by default).

benchmarks:

In [18]: %timeit [5 * i for i in my_list]
463 ns ± 10.6 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)

In [19]: %timeit list(map((5).__mul__, my_list))
784 ns ± 10.7 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)

In [20]: %timeit [5 * i for i in my_list * 100000]
20.8 ms ± 115 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

In [21]: %timeit list(map((5).__mul__, my_list * 100000))
30.6 ms ± 169 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)


In [24]: arr = np.array(my_list * 100000)

In [25]: %timeit arr * 5
899 µs ± 4.98 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-multiply-numbers-list-3-different-ways
Multiply All Numbers in the List in Python - GeeksforGeeks
Explanation: start with res = 1 and then multiply each number in the list with res using a for loop.
Published   October 28, 2025
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-multiply-two-list
Python - Multiply Two Lists - GeeksforGeeks
July 12, 2025 - map() function applies a lambda function to each pair of elements from lists a and b multiplying them together. Result is converted to a list producing [4, 10, 18], where each element is the product of corresponding elements from a and b. Comment · Article Tags: Article Tags: Python ·
Find elsewhere
🌐
Coding Confessions
blog.codingconfessions.com › confessions of a code addict › why do python lists multiply oddly? a cpython internals deep dive
Why Do Python Lists Multiply Oddly? Exploring the CPython Source Code
April 26, 2024 - In Python, the * operator when used on a sequence type object (such as lists, strings), repeats the elements of the object x number of times.
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › python list multiply
Python List Multiply - Spark By {Examples}
May 31, 2024 - You can use different approaches of Python to multiply list elements in Python. One of the approaches is multiplying each element of a list by a number
🌐
CodeGym
codegym.cc › java blog › learning python › multiply in python
Multiply in Python
August 14, 2024 - The reduce function from the functools module can be used to apply a function (in this case, multiplication) cumulatively to the items of the list, from left to right. from functools import reduce from operator import mul numbers = [2, 3, 4] result = reduce(mul, numbers) print(result) # Output: 24 · In Python 3.8 and later, the math module provides the prod function, which can be used directly on a list to get the product of all elements.
🌐
TutorialsPoint
tutorialspoint.com › article › python-program-to-multiply-all-numbers-in-the-list
Python program to multiply all numbers in the list?
March 24, 2026 - The operator.mul() function provides another way to multiply numbers when combined with a loop ? from operator import mul numbers = [2, -3, 3, 2, 4, 5, 3] print('The list is:', numbers) product = 1 for num in numbers: product = mul(num, product) print('The product is:', product) The list is: [2, -3, 3, 2, 4, 5, 3] The product is: -2160 · For Python 3.8+, use math.prod() for the simplest solution.
🌐
Plain English
python.plainenglish.io › how-to-quickly-multiply-elements-in-a-list-in-python-16a2bd7205be
How to Quickly Multiply Elements in a List in Python | by Fatos Morina | Python in Plain English
February 10, 2022 - New Python content every day. Follow to join our 3.5M+ monthly readers. ... If you happen to learn programming from a textbook, you may have seen an example where you are told to exercise writing a quick program that allows you to find the product of elements, for example: If you however want to find the product of all elements in a list, you need to iterate through that list in the following way:
🌐
Quora
quora.com › How-do-I-multiply-two-lists-in-Python
How to multiply two lists in Python - Quora
Answer: list1 and list2 are the two veriable decleration list1 = [1, 2, 3] list2 = [4, 5, 6] products = [] initialize result list. #declear array products for multiplication for num1, num2 in zip(list1, list2): //looping through the array of list1 and list2 products. append(num1 * num2) //ap...
🌐
TutorialsPoint
tutorialspoint.com › article › python-repeat-and-multiply-list-extension
Python - Repeat and Multiply List Extension
March 27, 2026 - Python provides several methods to repeat and multiply list elements. This article explores different approaches to extend lists by repeating elements or multiplying their values.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-multiplying-alternate-elements-in-list
Python | Multiplying Alternate elements in List - GeeksforGeeks
April 9, 2023 - We can have list comprehension to get run the logic and list slicing can slice out the alternate character, product by the external prod function. ... # Python3 code to demonstrate # Multiplying Alternate elements in List # using list comprehension + list slicing # getting Product def prod(val) : res = 1 for ele in val: res *= ele return res # initializing list test_list = [2, 1, 5, 6, 8, 10] # printing original list print("The original list : " + str(test_list)) # using list comprehension + list slicing # Multiplying Alternate elements in List res = [prod(test_list[i : : 2]) for i in range(len(test_list) // (len(test_list)//2))] # print result print("The alternate elements product list : " + str(res))
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › multiply all numbers in python list
Multiply all Numbers in Python List - Spark By {Examples}
May 31, 2024 - How to multiply all numbers in the Python list? You can use the multiplication operator (*) is indeed used for multiplying two numbers together. It can be
🌐
Python documentation
docs.python.org › 3 › library › random.html
random — Generate pseudo-random numbers
1 month ago - Complementary-Multiply-with-Carry recipe for a compatible alternative random number generator with a long period and comparatively simple update operations.
🌐
TutorialsPoint
tutorialspoint.com › article › multiplying-alternate-elements-in-a-list-using-python
Multiplying Alternate elements in a List using Python?
March 27, 2026 - The iterative approach uses a loop to traverse the list and multiply elements at even indices.
🌐
TutorialsPoint
tutorialspoint.com › article › python-multiply-each-element-in-a-sublist-by-its-index
Python-Multiply each element in a sublist by its index
March 27, 2026 - import numpy as np def multiply_by_index_numpy(sublists): sublists_array = np.array(sublists) indices = np.arange(len(sublists)) multiplied_array = sublists_array * indices[:, np.newaxis] return multiplied_array.tolist() # Example usage sublists = [[7, 2, 8], [4, 5, 6], [3, 8, 9]] result = multiply_by_index_numpy(sublists) print("Result:", result) ... Use for loops for simple cases and maximum readability. Choose NumPy for large datasets requiring optimal performance. List comprehension offers a good balance between conciseness and performance for medium-sized data.
Top answer
1 of 4
16
If you just learned loops, what you are looking for is a for loop. Since you mentioned functions we'll go ahead and make this a function. What do we want in our function? Well, we want it to take a list and return the multiplied values. NOTE: For simplicity, I'm going to assume your list is valid (numbers only), but in an actual function you'd want some error checking. How does our function definition look? def multiply_list_values(number_list): OK! We have the basics. So let's think through what we want to do. We want to go through each value of the list and multiply it with the previous total. We could also easily use recursion here, but since you didn't mention learning that I won't. It's fairly simple in either case. So how do you go through all the values of a list? Using a for...in loop. It will look something like this: def multiply_list_values(number_list): for number in number_list: print(number) If you run this, and have number_list as a list of numbers, you will see each individual number printed out in order. That's a good start, but it doesn't really do what we want. So lets think about our base case, where we want the very first number multiplied. If we were adding, we'd start at 0, but since we're multiplying, we need to start with 1, as 1 * X = X. Let's see how this looks: def multiply_list_values(number_list): result = 1 for number in number_list: print(result * number) Well, we get the same thing. What we need to do is multiply the value by each subsequent number to continually increment the result. How do we do this? We can assign a variable the result of a calculation involving itself. This doesn't work like a math equation. For example, if you had a variable x = 1 and wanted to add 2 to that value, you could do this: x = x + 2 and now x would be 3. So let's try the same thing with multiplication: def multiply_list_values(number_list): result = 1 for number in number_list: result = result * number print(result) So what do we have now? If you run this, you'll see the multiplied values getting higher and higher, and it will run through the whole list. Great! That's exactly what we want. Incidentally, this is such a common thing to do there is a shorthand way built into Python to make this easier. Instead of result = result * number you can remove the result on the right side and put your math operator before the equals sign like this: result *= number. This does the exact same thing. In our x example, you could change the x = x + 2 to x += 2 for the same result. Now that the math is finished, we just need to return the result after the loop, making our simplified and final function look like this (with test usage): def multiply_list_values(number_list): result = 1 for number in number_list: result = result * number return result def main(): number_list = [1, 2, 3, 4, 5] print(multiply_list_values(number_list)) # Output # 120 if __name__ == '__main__': main() There are many problems in Python (and programming in general) that can be solved this way. The for..in loop is extremely useful and can be used for all sorts of operations, not just mathematical ones, so keep it in mind whenever you want to do operations on every element of a list or dictionary. Let me know if you have questions!
2 of 4
4
Well, loops are indeed the right thing to do here. One approach would be to keep a running total: start with a value of 1, then loop through the list and multiply your total by the current value each time.