Your idea is right, but you can write it down a bit simpler:

list_a = [1,2,3,4,5] # or hh[0]
list_b = [6,7,8,9,0] # or hh[1]
multiplied = [a * b for a, b in zip(list_a, list_b)]

Also, if you want / operator to return float, add from __future__ import division at the top of your source.

Answer from 9000 on Stack Overflow
🌐
w3resource
w3resource.com › python-exercises › numpy › basic › numpy-basic-exercise-59.php
NumPy: Multiply two given arrays of same size element-by-element - w3resource
August 28, 2025 - By applying element-wise multiplication, the program generates a new array containing the products of the corresponding elements from the two input arrays, facilitating various computational tasks such as linear algebra operations or data transformations. ... # Importing the NumPy library with an alias 'np' import numpy as np # Creating two NumPy arrays 'nums1' and 'nums2' containing 2x3 matrices nums1 = np.array([[2, 5, 2], [1, 5, 5]]) nums2 = np.array([[5, 3, 4], [3, 2, 5]]) # Printing the contents of 'nums1' array print("Array1:") print(nums1) # Printing the contents of 'nums2' array print("Array2:") print(nums2) # Performing element-wise multiplication of arrays 'nums1' and 'nums2' using np.multiply() # This operation multiplies corresponding elements of the two arrays print("\nMultiply said arrays of same size element-by-element:") print(np.multiply(nums1, nums2))
Discussions

python - Multiplication of two arrays in numpy - Stack Overflow
A third approach is to insert a new axis in one the arrays and then multiply, although this is a little more verbose: >>> (x[:, np.newaxis] * y).T array([[3, 6], [4, 8]]) For those interested in performance, here are the timings of the operations, from quickest to slowest, on two arrays of ... More on stackoverflow.com
🌐 stackoverflow.com
python - How to perform element-wise multiplication of two lists? - Stack Overflow
I want to perform an element wise multiplication, to multiply two lists together by value in Python, like we can do it in Matlab. This is how I would do it in Matlab. a = [1,2,3,4] b = [2,3,4,5] ... More on stackoverflow.com
🌐 stackoverflow.com
python - Multiply arrays in array with two numbers - Stack Overflow
Just convert your data to arrays and then simply take a product *. The trick here is to create a 1-d vector of your two values with which you want to multiply. More on stackoverflow.com
🌐 stackoverflow.com
May 23, 2019
python - multiplying two array in python3.7 - Data Science Stack Exchange
You are simply defining your array so that it is made of python sets. That is a different data structure which is not able to be multiplied, unlike an array. More on datascience.stackexchange.com
🌐 datascience.stackexchange.com
August 11, 2019
🌐
Reddit
reddit.com › r/learnpython › how to multiply two arrays of matrices in python?
r/learnpython on Reddit: How to multiply two arrays of matrices in Python?
July 25, 2023 -

Hi! I'm stuck with the following problem: I have two arrays of size (4,4,N) each, M1 and M2, so one can think of them as an 'array of matrices' or 'vector of matrices' of size 4x4. I want to 'multiply' the two arrays so that i get as an output an array M of the same size (4,4,N), where each element of the last dimension of M, M[:,:,i], i = {0,1, ... , N-1} is the matrix multiplication of the corresponding ith elemets of M1 and M2.

The hardcode way of doing it is

for i in rage(0,N): M[:,:,i] = M1[:,:,i] @ M2[:,:,i]

But I'm sure there's a more efficient way of doing it. I've searched on stackoverflow and tried with np.einsum() and boradcasting, but struggled in all my attempts.

I'm pretty new to Python, so don't be so hard with me😅.

Thank you for your help!

🌐
Vultr Docs
docs.vultr.com › python › third-party › numpy › multiply
Python Numpy multiply() - Multiply Array Elements | Vultr Docs
November 18, 2024 - Apply numpy.multiply() with a scalar ... that arrays should be of the same shape for element-wise multiplication. Create two arrays of the same size....
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.multiply.html
numpy.multiply — NumPy v2.4 Manual
Equivalent to x1 * x2 in terms of array broadcasting. ... Try it in your browser! >>> import numpy as np >>> np.multiply(2.0, 4.0) 8.0
🌐
Quora
quora.com › How-do-you-multiply-2D-arrays-in-Python
How to multiply 2D arrays in Python - Quora
You can perform standard matrix multiplication with the operation np.matmul(a, b) if the array a has shape (x, y) and array be has shape (y, z) for some integers x, y, and z. Problem Formulation: Given a two-dimensional NumPy array (=matrix) a with shape (x, y) and a two-dimensional array b with shape (y, z).
🌐
Okpedia
how.okpedia.org › en › python › how-to-multiply-two-arrays-matrix-in-python
[Python] How to Multiply Two Arrays Matrix - Okpedia
Give two arrays A and B defined with the array function. A = np.array ([[1,2], [3,4], [5,6]]) B = np.array ([[1,2,3], [3,4,5]]) The number of rows in the first array must be equal to the number of columns in the second array. The product is calculated row by column using the dot () function.
Find elsewhere
🌐
Problem Solving with Python
problemsolvingwithpython.com › 05-NumPy-and-Arrays › 05.07-Array-Opperations
Array Operations - Problem Solving with Python
NumPy array can be multiplied by each other using matrix multiplication. These matrix multiplication methods include element-wise multiplication, the dot product, and the cross product. The standard multiplication sign in Python * produces element-wise multiplication on NumPy arrays.
🌐
GeeksforGeeks
geeksforgeeks.org › python › numpy-multiply-in-python
numpy.multiply() in Python - GeeksforGeeks
July 11, 2025 - When both inputs are arrays of the same shape numpy.multiply() multiplies corresponding elements together.
🌐
Data Science Parichay
datascienceparichay.com › home › blog › numpy – elementwise multiplication of two arrays
Numpy - Elementwise multiplication of two arrays - Data Science Parichay
June 17, 2022 - You can use the numpy np.multiply() function to perform the elementwise multiplication of two arrays. Alternatively, you can also use the * operator.
🌐
Replit
replit.com › home › discover › how to multiply arrays in python
How to multiply arrays in Python | Replit
April 13, 2026 - For standard Python lists, a list comprehension offers a concise way to perform element-wise multiplication. This approach combines the zip() function with a loop to process two lists simultaneously.
🌐
Sharp Sight
sharpsight.ai › blog › numpy-multiply
How to Use the Numpy Multiply Function - Sharp Sight
November 12, 2021 - You can use np.multiply to multiply two same-sized arrays together. This computes something called the Hadamard product. In the Hadamard product, the two inputs have the same shape, and the output contains the element-wise product of each of the input values.
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.multiply.html
numpy.multiply — NumPy v2.2 Manual
Equivalent to x1 * x2 in terms of array broadcasting. ... >>> x1 = np.arange(9.0).reshape((3, 3)) >>> x2 = np.arange(3.0) >>> np.multiply(x1, x2) array([[ 0., 1., 4.], [ 0., 4., 10.], [ 0., 7., 16.]])
Top answer
1 of 4
5

Just convert your data to arrays and then simply take a product *. The trick here is to create a 1-d vector of your two values with which you want to multiply. The * then performs element wise multiplication

import numpy as np

mult = np.array([1080, 1920])
inp = np.array([[0.4375, 0.3477366255144033], [0.3599537037037037, 0.676954732510288], 
                [0.5648148148148148, 0.720164609053498], [0.8483796296296297, 0.44238683127572015], 
                [0.8726851851851852, 0.3374485596707819]])

result = inp*mult
# array([[ 472.5       ,  667.65432099],
#        [ 388.75      , 1299.75308642],
#        [ 610.        , 1382.71604938],
#        [ 916.25      ,  849.38271605],
#        [ 942.5       ,  647.90123457]])

EDIT:: Time comparison Both methods work similarly

%timeit inp*mult
# 2.89 µs ± 365 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

%timeit np.multiply(inp, mult)
# 2.55 µs ± 322 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
2 of 4
2

You want to perform element-wise multiplication of arrays. So use numpy.multiply() method.

>>> x1 = np.array([[0.4375, 0.3477366255144033], [0.3599537037037037, 0.676954732510288], [0.5648148148148148, 0.720164609053498], [0.8483796296296297, 0.44238683127572015], [0.8726851851851852, 0.3374485596707819]])
>>>
>>> x1
array([[0.4375    , 0.34773663],
       [0.3599537 , 0.67695473],
       [0.56481481, 0.72016461],
       [0.84837963, 0.44238683],
       [0.87268519, 0.33744856]])
>>> x2 = np.array([1080, 1920])
>>> x2
array([1080, 1920])
>>> prod = np.multiply(x1, x2)
>>> prod
array([[ 472.5       ,  667.65432099],
       [ 388.75      , 1299.75308642],
       [ 610.        , 1382.71604938],
       [ 916.25      ,  849.38271605],
       [ 942.5       ,  647.90123457]])

EDIT: As answered by @Sheldore above, using * operator is fine too, and does the same job.

🌐
Programiz
programiz.com › python-programming › examples › multiply-matrix
Python Program to Multiply Two Matrices
Here are a couple of ways to implement matrix multiplication in Python. # Program to multiply two matrices using nested loops # 3x3 matrix X = [[12,7,3], [4 ,5,6], [7 ,8,9]] # 3x4 matrix Y = [[5,8,1,2], [6,7,3,0], [4,5,9,1]] # result is 3x4 result = [[0,0,0,0], [0,0,0,0], [0,0,0,0]] # iterate through rows of X for i in range(len(X)): # iterate through columns of Y for j in range(len(Y[0])): # iterate through rows of Y for k in range(len(Y)): result[i][j] += X[i][k] * Y[k][j] for r in result: print(r)
🌐
Medium
medium.com › @heyamit10 › numpy-multiply-in-python-7914322b2888
numpy.multiply() in Python. If you think you need to spend $2,000… | by Hey Amit | Medium
February 8, 2025 - Multiplying Arrays of Different Shapes (Broadcasting) You might be wondering, “What happens when arrays don’t have the same shape?” · Don’t worry — NumPy handles this beautifully with a feature called broadcasting. Simply put, broadcasting stretches smaller arrays to match the shape of larger ones, making operations seamless. ... import numpy as np # Define two arrays with different shapes array1 = np.array([[1, 2], [3, 4]]) # 2x2 array array2 = np.array([10, 20]) # 1D array with 2 elements # Multiply arrays using broadcasting result = np.multiply(array1, array2) print(result) # Output: # [[10 40] # [30 80]]
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.multiply.html
numpy.multiply — NumPy v2.1 Manual
Equivalent to x1 * x2 in terms of array broadcasting. ... >>> x1 = np.arange(9.0).reshape((3, 3)) >>> x2 = np.arange(3.0) >>> np.multiply(x1, x2) array([[ 0., 1., 4.], [ 0., 4., 10.], [ 0., 7., 16.]])