11
What is the output of the following code?
pairs = [(1, 'b'), (2, 'a')]
print(sorted(pairs, key=lambda p: p[1])[0])DiscussMedium
Loading subject content…
Loading practice questions…
What is the output of the following code?
pairs = [(1, 'b'), (2, 'a')]
print(sorted(pairs, key=lambda p: p[1])[0])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?
print(list(filter(lambda x: x > 2, [1, 2, 3, 4])))What is the output of the following code?
for i, ch in enumerate('ab', start=1):
print(i, ch, end=' ')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))