0
rewrite the function as a Lambda function:
def func (x): return x**4 print (func (7))
2 odpowiedzi
+ 2
myfunc = lambda x: x**4
print(myfunc(7))
0
# Lambda is an anonimous funtion like this
# normal method for create a funtion
def plus(x,y):
return x+y
# how use lambda as anonimous funtion
sum = lambda x,y:x+y
# call the first funtion
print(plus(2,5))
# call the anonimous funtion
print(sum(2,5))
# the different is the when you define a funtion you have to specify is this funtion has
# return or no in the case of lambda we dont specify but it is on it.