Python Program To Find Average Of Numbers In A List – Programming Code Examples
Python

Python Program To Find Average Of Numbers In A List3 min read

In this tutorial, we will discuss a concept of Python program to find Average of numbers in a list.

This program uses to calculate the sum and average of the integer number in the list of Python language.




If the list of numbers given to find the average, the sum of the numbers divided by the number of elements of the list.

Program 1

Calculate average in an integer number list

In this programs, we can see step by step procedure for completion of the program.

  • Define the sum variable and initialize as zero
  • Create a number list in Python language
  • use a for loop for calculating the sum
  • then, calculates the average of the list elements
  • Which Displays sum and average on the screen

When the above code is executed, it produces the following results

Program 2

Calculate average in a decimal number list

When the above code is executed, it produces the following results

Program 3

Calculate average in an integer number list -takes input from the user

This program takes input from the user one by one and calculates sum and average of the integer number in the list

In this programs, we can see step by step procedure for completion of the program.

  • Define the sum variable and initialize as zero
  • Create an empty list in Python language
  • Takes input from the user for the number of elements in the list
  • Use a for loop to store element in the list and calculate the sum
  • Then, calculates the average of the list elements
  • Finally, Which is Displayed sum and average on the screen

When the above code is executed, it produces the following results

Program 4

Calculate average in a decimal  number list -takes input from the user

This program takes input from the user one by one and calculates sum and average of the decimal number in the list

When the above code is executed, it produces the following results

Leave a Comment