Here i will discuss about lambda function in python
Table of contents
No headings in the article.
#lambda function in python
## How Do we use lambda in python
# with one arguments
x = lambda a: a +10
print(x(5))
# with two arguments
y = lambda A,B : A*B
print(y(5,6))
# with three arguments
z= lambda A,B,C : A*B*C
print(z(5,6,7))
#write a program to double a given number and add two numbers using lambda funstion
double = lambda a1 : a1 *2
add = lambda b2,c2 : b2 + c2
# now take input from user
num1 = int(input("enter a number to get the double: "))
num2 = int(input("enter First number : "))
num3 = int(input("enter Seccond number : "))
# apply the function
result1 = double(num1)
result2 = add(num2, num3)
# print the result the
print("the Double of tho number is ", result1)
print("the Addition of tho number is ", result2)