Skip to content

Multiply each element in list Python NumPy | Example code

  • by

You have to import NumPy Module and use * to multiply each element in list Python NumPy.

Multiply each element in list Python NumPy

Simple example code Multiply every element in an array.

import numpy as np

list1 = [1, 2, 3, 4, 5]

a = np.array(list1)

print(a * 0.5)

Output:

Multiply each element in list Python NumPy

Do comment if you have any doubts or suggestions on this Python NumPy multiply topic.

Note: IDE: PyCharm 2021.3.3 (Community Edition)

Windows 10

Python 3.10.1

All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.

Leave a Reply

Your email address will not be published. Required fields are marked *