{"id":16563,"date":"2021-09-30T11:00:23","date_gmt":"2021-09-30T05:30:23","guid":{"rendered":"https:\/\/python-programs.com\/?p=16563"},"modified":"2021-11-22T18:35:32","modified_gmt":"2021-11-22T13:05:32","slug":"python-program-divide-all-elements-of-a-list-by-a-number","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-divide-all-elements-of-a-list-by-a-number\/","title":{"rendered":"Python Program Divide all Elements of a List by a Number"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Get Sum of all the Factors of a Number<\/a><\/p>\n

Given a list, and the task is to divide all the elements of a given List by the given Number in Python<\/p>\n

As we know, elements such as int, float, string, and so on can be stored in a List. As we all know, dividing a string by a number is impossible. To divide elements of a list, all elements must be int or float.<\/p>\n

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

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

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

Given List = [3, 2.5, 42, 24, 15, 32]\r\nGiven Number = 2<\/pre>\n

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

The above given list after division all elements of a List by the given Number= [1.5, 1.25, 21.0, 12.0, 7.5, 16.0]<\/pre>\n

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

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

Given List =\u00a0 [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]\r\nGiven Number = 5<\/pre>\n

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

The above given list after division all elements of a List by the given Number= [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]<\/pre>\n

Program Divide all Elements of a List by a Number<\/h2>\n

Want to excel in java coding? Practice with these Java Programs examples with output<\/a> and write any kind of easy or difficult programs in the java language<\/p>\n

Below are the ways to divide all Elements of a List by a Number.<\/p>\n