# DataScience - Python Lambda Functions

n = 3 p = 2

def test(n,p): return n\*\*p

test(3,2)  
Here, we create test function.

Lambda Function:

a = lambda n , p: n\*\*p

a(3,2)

we use lambda keyword and take 2 inputs n,p; then after colon we put the output we want, then we store function inside variable 'a' and call it.  
It is also called anonymous function bcoz this is a function without a name.

Do Not Use Lambda Function for Complex Functions, only use for simple functions.  
Celsius to Farhenheit:

c\_to\_f = lambda c : (9/5)\*c + 32

c\_to\_f(100)

Finding max:

finding\_max = lambda x,y : x if x&gt;y else y

finding\_max(5,10)

Lambda Function to find length:

s = "karan"

find\_len = lambda s : len(s)

find\_len(s)
