To calculate average ir arithmetic mean of numbers in python, you have to ask from user to enter some set of numbers say 5 numbers to find the average of those numbers as shown in the program given here.
Following python program ask from user to enter 5 numbers to find the average of all numbers:
# Python Program - Calculate Average of Numbers while True: print("Enter 'x' for exit.") print("Enter any 5 numbers to find average: ") n1 = input() n2 = input() n3 = input() n4 = input() n5 = input() if n1 == 'x': break else: number1 = int(n1) number2 = int(n2) number3 = int(n3) number4 = int(n4) number5 = int(n5) sum = number1 + number2 + number3 + number4 + number5 average = sum/5 print("Average of entered 5 numbers is ", average, "\n")
Here is the sample run of the above Python program shows how to calculate and print average of numbers:
You may also like to learn or practice the same program in other popular programming languages: