Learn about Python Program to Calculate the Average of 4 Number in the below code example. Also, refer to the comments in the code snippet to get a detailed view about what’s actually happening.
Contents
Python Program to Calculate the Average of 4 Number
# Program to find average of four numbers
num1 = 5
num2 = 10
num3 = 15
num4 = 20
# calculate average of 4 numbers
avg = (num1 + num2 + num3 + num4) / 4
# print result
print('The average of numbers = %0.2f' %avg)
Output:
The average of numbers = 12.50
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Code : Average of 3 Numbers in Python using Function