What will this code do?
tup = (5, 7, 22, 97)
newtup = tuple(map(lambda x: x + 3, tup))
print(newtup)
Choose your answer
Anonymous Quiz
21%
[8, 10, 25, 100]
67%
(8, 10, 25, 100)
5%
<map object at 0x000001D7B2539F28>
3%
None
5%
Error
0%
See solution
What will this code do?
import numpy as np
a = np.array([[101, 99],[102, 98]])
print(np.max(a))
Choose your answer
Anonymous Quiz
0%
101
77%
102
14%
[102, 98]
3%
[101, 99]
3%
Error
3%
See solution
What will this code do?
def func(x):
if x >= 3:
return x
y = filter(func, (1, 2, 3, 4))
print(list(y))
👍2
What will this code do?
def func(x):
if x < 3:
return x
y = filter(func, (0, 1, 2, 3, 4))
print(list(y))
Choose your answer
Anonymous Quiz
75%
[0, 1, 2]
18%
[1, 2]
0%
[2]
3%
(0, 1, 2)
0%
(1, 2)
0%
(2)
3%
None
3%
TypeError
0%
See solution
What will this code do?
def f():
import sys
locs = sys._getframe(1).f_locals
setattr(locs['self'], 'xy', 4*locs['x'] + 7*locs['y'])
class A:
def __init__(self, x, y):
self.xy = 2*x + 3*y
f()
a = A(2, 3)
A.xy = 99
print(a.xy)
What will this code do?
from functools import reduce
y = reduce(lambda a, b: a + b , [1, 2, 3, 4])
print(y)
Choose your answer
Anonymous Quiz
0%
[1, 2]
0%
[1]
3%
1
5%
3
0%
[3]
32%
[3, 7]
8%
[10]
30%
10
11%
Error
11%
See solution
What will this code do?
a = {1: "London", 3: "Berlin"}
b = {2: "New York", 3: "Moscow", 4: "Geneva"}
c = {**a, **b}
print(c)What will this code do?
import numpy as np
matrix_a = np.array([
[1, 1, 1],
[1, 1, 1],
[1, 1, 2]
])
matrix_b = np.array([
[1, 3, 1],
[1, 3, 1],
[1, 3, 8]
])
с = matrix_a + matrix_b
print(с)
What will this code do?
c = map(lambda x: x + x, filter(lambda x: x>3, (1, 2, 3, 4)))
print(list(c))
Choose your answer
Anonymous Quiz
5%
[2, 4, 6, 8]
68%
[8]
11%
[6, 8]
7%
[4, 4]
0%
[6]
5%
None
4%
See solution