Python | Multiplying Elements in a List by Number

For multiplying all of numbers in a Python List with some specific number just use List Comprehension like [element * number for element in list]
Below are some examples of Python Code showing Multiplication of Elements of a List by a number.

Example 1

# Python code for multiplying numbers in List with a specific number
a_list = [12, 94, 92]

multiplied_list = [element * 3 for element in a_list]

print(multiplied_list)
# Return [36, 282, 276]

Example 2

# Python code for multiplying numbers in List with a specific number
a_list = [37, 91, 73]

multiplied_list = [element * 5 for element in a_list]

print(multiplied_list)
# Return [185, 455, 365]

Example 3

# Python code for multiplying numbers in List with a specific number
a_list = [36, 28, 81]

multiplied_list = [element * 10 for element in a_list]

print(multiplied_list)
# Return [360, 280, 810]

More About Python Lists

Comments to: Python | Multiplying Elements in a List by Number

Your email address will not be published.