Python Program to find the average of 5 numbers using a lambda function


In this program, you will learn how to find the average of 5 numbers using a lambda function in Python.


x = lambda a, b, c, d, e: (a + b + c + d + e) / 5

Example: How to find the average of 5 numbers using a lambda function in Python

x = lambda a, b, c, d, e: (a + b + c + d + e) / 5

a = int(input("Enter first number:"))
b = int(input("Enter second number:"))
c = int(input("Enter third number:"))
d = int(input("Enter fourth number:"))
e = int(input("Enter fifth number:"))

result = x(a, b, c, d, e)
print("Average is:", result)

Output:

Enter first number:10
Enter second number:20
Enter third number:30
Enter fourth number:40
Enter fifth number:50
Average is: 30.0