Choose the correct answer
Anonymous Quiz
8%
100 d99
4%
100 889
40%
100 899
0%
200 d99
8%
200 889
0%
200 899
16%
1024 d99
4%
1024 889
8%
1024 899
12%
See solution
👍1
What will this code do?
from functools import partial
from operator import gt
gt = partial(gt, 0)
l = list(filter(gt, [x for x in range(-2, 3) if x >= 0]))
print(l)
Choose the correct answer
Anonymous Quiz
11%
[]
3%
[-2, -1]
20%
[1, 2]
17%
[-2, -1, 0]
14%
[0, 1, 2]
17%
[-2, -1, 1, 2]
6%
[0]
11%
See solution
What will this code do?
M = [[1, 2], [3, 4]]
N = [[5, 6], [7, 8]]
sum([col1*col2 for row1, row2 in zip(M, N) for col1, col2 in zip(row1, row2)])
Choose the correct answer
Anonymous Quiz
10%
36
12%
62
24%
70
27%
94
15%
100
5%
5760
7%
See solution
Which of the functions must be explicitly imported in order to use it?
Anonymous Quiz
17%
map
10%
filter
13%
reduce
10%
vars
23%
classmethod
6%
dir
6%
repr
15%
See solution
Are given 4 code variant:
#1
[х ** 2 for х in range(5) if х % 2 == 0]
#2
list(map(lambda x: x**2, filter(lambda x: x % 2 == 0, range(5))))
#3
res = []
for x in range(5):
if x % 2 == 0:
y = x**2
res.append(y)
print(res)
#4
list(map(lambda x: x ** 2 % 4 == 0, range(5)))
❤1
Which of the options will not bring [0, 4, 16]?
Anonymous Quiz
9%
1
20%
2
33%
3
33%
4
7%
See solution
What will this code do?
[((x // y):) for х in range(3) if х % 2 == 0 for y in range(3) if y % 2 == 1]
Choose the correct answer
Anonymous Quiz
10%
[(0, 1)]
14%
[(2, 1)]
16%
[(0, 1), (2, 1)]
22%
[(0, 1), (0, 2), (2, 1)]
24%
[(0, 1), (0, 3), (2, 1), (2, 3)]
16%
See solution
What will this code do?
res = [х ** y for х in [2, 3] for y in [2, 3]]
print(res)
Choose the correct answer
Anonymous Quiz
8%
[4, 8]
9%
[4, 27]
8%
[8, 9]
21%
[9, 27]
6%
[2, 3, 2, 3]
14%
[4, 6, 6, 9]
26%
[4, 8, 9, 27]
8%
See solution
What will this code do?
listoftuple = [(0, 1, 2), (1, 2, 3)]
string1 = [b for (a, b, c) in listoftuple]
string2 = list(map((lambda row: row[1]), listoftuple))
print(string1 == string2, sum(string1))
😁1
Choose the correct answer
Anonymous Quiz
20%
True 1
9%
False 1
8%
True 2
13%
False 2
19%
True 3
8%
False 3
5%
True 6
4%
False 6
14%
SyntaxError
What will this code do?
def gen():
for i in range(1, 5):
x = yield i
if x:
yield x**2
g = gen()
v = g.send(g.send(next(g) + next(g)) + next(g))
print(v)
😁1
Choose the correct answer
Anonymous Quiz
18%
1
6%
3
9%
4
8%
9
12%
16
8%
81
8%
121
16%
144
4%
StopIteration
9%
None
👍1
What will this code do?
M = [[1, 2], [3, 4]]
N = [[5, 6], [7, 8]]
sum([col1*col2 for row1, row2 in zip(M, N) for col1, col2 in zip(row1, row2)])
👍1
Choose the correct answer
Anonymous Quiz
0%
36
0%
62
26%
70
22%
94
13%
100
13%
5760
26%
See solution
Что выведет код?
from collections import defaultdict
d = defaultdict(list)
d['a'].append(1)
d['a'].append(2)
d['b'].append(3)
sum((len(d['a']*3), len(d['b'])*5))
Выберите правильный вариант
Anonymous Quiz
9%
3
6%
4
3%
6
18%
7
15%
10
21%
11
12%
12
6%
19
9%
Посмотреть результаты