Python Program to add two numbers using a lambda function


In this program, you will learn how to add two numbers using a lambda function in Python.


a = lambda x, y: x + y

Example: How to add two numbers using a lambda function in Python

a = lambda x, y: x + y

x = int(input("Enter first number:"))
y = int(input("Enter second number:"))

result = a(x, y)
print("Sum is:", result)

Output:

Enter first number:10
Enter second number:20
Sum is: 30