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

In the previous article, we have discussed Python Program to Check a Binary Number is Divisible by a number N.<\/a>
\nGiven a list and the task is to add a given input number to each element in a list.<\/p>\n

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

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

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

Given list = [2, 4, 6, 8, 10]\r\nGiven number = 5<\/pre>\n

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

The given list after addition of a number to each element in a list =  [7, 9, 11, 13, 15]<\/pre>\n

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

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

Given list = [1, 4, 6, 2, 9]\r\nGiven number = 10<\/pre>\n

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

The given list after addition of a number to each element in a list = [11, 14, 16, 12, 19]<\/pre>\n

Program to Add Number to each Element in a List<\/h2>\n

Below are the ways to add a given input number to each element in a list.<\/p>\n