Home » Average of 4 Numbers in Python

# Average of 4 Numbers in Python

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

#### Average of 4 Numbers in Python

The below program finds the average of four numbers given by the user.

``````# Program to find average of four numbers

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

# calculate average of numbers
avg = (num1 + num2 + num3 + num4) / 4

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

Output:

```first number: 5
second number: 10
third number: 15
four number: 20
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 : Python Program to Calculate the Average of 4 Number