Home » Python Average of Two Numbers

Python Average of Two Numbers

Learn about Python Average of Two Numbers 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 Average of Two Numbers

# Python program to find average of two numbers

num1 = 30
num2 = 10

# calculate average
avg = (num1 + num2) / 2

# print value
print('The average of numbers = %0.2f' %avg)

Output:

The average of numbers = 20.00

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Code : Python Program to Find Average of Two Numbers