Python – Average of Two Numbers

Python Program to Find Average of Two Numbers

To find the average of two numbers in Python, first find the sum, and then divide the sum by 2.

We can use Addition Operator to find the sum, and Division Operator to divide the sum by 2. Since, we are finding the average of only two numbers, we divide the sum by 2.


In this program, we shall take two numbers in x, y; and find their average.

Python Program

x = 5
y = 2

sum = x + y
average = sum / 2
print(f'Average = {average}')


Average = 3.5


In this tutorial of Python Examples, we learned how to find the average of given two numbers.