-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11.lambda.py
More file actions
39 lines (29 loc) · 1.31 KB
/
11.lambda.py
File metadata and controls
39 lines (29 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# lambda
'''
Syntax of lambda function:
normal function syntax:
def functionname():
expression
lambda arguments : expression
'''
lamdbaValue = lambda num,num1,num2 : num + num1 + num2
print('\nlambdavaleu ans: ',lamdbaValue(10,20,30))
# creating noral function with inner lambda functon
def sumNum(a, b):
# add = a + b
# print('\nsumNum: ',add)
# in this step you have a and b values but lamval is a lambda function which needs to call and passs one agrument which is lam.
# for that in our case we will return the lamval lambda fucntion, so need to pass lam argument from outside the sumNum function
lamval = lambda lam : lam + a + b
return lamval
# print('lamval(): ',lamval(100))
# call sumnum funciton
# forPassingLamVal is a varibale which holds the lambda function and in this case neet to be pass lam argument value
forPassingLamVal = sumNum(10,20)
lam1 = sumNum(50,100)
print('\n\nforPassingLamVal: ',forPassingLamVal(200))
print('\n\nlam1: ',lam1(500))
'''
Programss
1. creat a function in whcih recive 4 different numbers and also check if user insert otherthen integer value then show not accepted input message to user otherwise in function use lambda fucntion to give one admin number and then perform addition, multiplication, div and subtraction functions seprately with same concepts.
'''