Lambda function in Python
Defining a function in a single line in Python
multiply = lambda a, b : a*b
sum = lambda a, b : a+b
div = lambda a, b : a/b
subt = lambda a, b : a-b
square = lambda a : a**2
cube = lambda a : a**3
sqrt = lambda a : a**0.5
print(multiply(2, 3))
print(sum(2, 3))
print(div(2, 3))
print(subt(2, 3))
print(square(2))
print(cube(2))
print(sqrt(9))
Comments
Post a Comment
Write something to CodeWithAbdur!