Skip to content
Home » Average of 3 Numbers in Python from User Input

Average of 3 Numbers in Python from User Input

Learn about Average of 3 Numbers in Python from User Input in the below code example. Also, refer to the comments in the code snippet to get a detailed view about what’s actually happening.

Average of 3 Numbers in Python from User Input

# Python program to find average of three numbers

num1 = float(input('first number: '))
num2 = float(input('second number: '))
num3 = float(input('third number: '))

# calculate average
avg = (num1 + num2 + num3)/3

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

Output:

first number: 6
second number: 2
third number: 9
The average of numbers = 5.67

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 the Average of Three Numbers