Dremendo Tag Line

Print sum and average of 5 numbers in Python

print() - Question 10

In this question, we will see how to print the sum and average of 5 numbers in python programming using the print() function. To know more about print() function click on the print() function lesson.

Q10) Write a program in python to print the sum and average of 5 number like 9, 5, 8, 34, and 15.

Program

print('Sum of of 9, 5, 8, 34, and 15 = {}'.format(9+5+8+34+15))
print('Average of 9, 5, 8, 34, and 15 = {:.2f}'.format((9+5+8+34+15)/5))

Output

Sum of of 9, 5, 8, 34, and 15 = 71
Average of 9, 5, 8, 34, and 15 = 14.20
video-poster