16
What is the output of the following code?
from functools import reduce
print(reduce(lambda a, b: a * b, [1, 2, 3, 4]))DiscussMedium
Loading subject content…
Loading practice questions…
What is the output of the following code?
from functools import reduce
print(reduce(lambda a, b: a * b, [1, 2, 3, 4]))What is the output of the following code?
pairs = [(1, 'b'), (2, 'a')]
print(sorted(pairs, key=lambda p: p[1]))What is the output of the following code?
from functools import lru_cache
@lru_cache
def fib(n):
return n if n < 2 else fib(n - 1) + fib(n - 2)
print(fib(30))