{"id":13667,"date":"2021-09-30T11:00:36","date_gmt":"2021-09-30T05:30:36","guid":{"rendered":"https:\/\/python-programs.com\/?p=13667"},"modified":"2021-11-22T18:35:31","modified_gmt":"2021-11-22T13:05:31","slug":"python-program-to-multiply-each-element-of-a-list-by-a-number","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-multiply-each-element-of-a-list-by-a-number\/","title":{"rendered":"Python Program to Multiply Each Element of a List by a Number | How to Multiply Each Element in a List by a Number in Python?"},"content":{"rendered":"

Have you mastered basic programming topics of java and looking forward to mastering advanced topics in a java programming language? Go with these ultimate Advanced java programs examples with output<\/a> & achieve your goal in improving java coding skills.<\/p>\n

Multiplying each element of a list will create a new list with each value from the original list multiplied by the number specified. In this tutorial, we have explained the different methods on how to multiply each element of the list by a number in python using for loops, numpy array, list comprehension, etc. Learn the Multiplication of All Elements of a List Process by having a quick glance at the sample python programs provided below.<\/p>\n

Multiply Each Element of a List by a Number in Python Examples<\/h3>\n

Given a list and a number the task is to multiply each element of the given list by the given number in Python.<\/p>\n

Example 1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given list = [12, 9, 4, 1, 47, 28, 19, 45, 9, 1, 4, 2, 5]\r\nGiven element =6<\/pre>\n

Output:<\/strong><\/p>\n

The original list is [12, 9, 4, 1, 47, 28, 19, 45, 9, 1, 4, 2, 5]\r\nThe given list after multiplying with 6 is:\r\n[72, 54, 24, 6, 282, 168, 114, 270, 54, 6, 24, 12, 30]<\/pre>\n

Example 2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given list = [7, 1, 45, 88, 12, 65, 2, 3, 9, 7]\r\nGiven element =10<\/pre>\n

Output:<\/strong><\/p>\n

The original list is [7, 1, 45, 88, 12, 65, 2, 3, 9, 7]\r\nThe given list after multiplying with 10 is:\r\n[70, 10, 450, 880, 120, 650, 20, 30, 90, 70]<\/pre>\n

How to Multiply Each Element in a List by a Number in Python?<\/h2>\n

Below are the ways to multiply each element of the given list by the given number in Python.<\/p>\n