Python & ML tasks
421 subscribers
2 photos
3 links
Python, functions, classes, iterators, generators, numpy, pandas, scikit-learn, TensorFlow
for advertising: @dina_ladnyuk

For advertising and donations in USD:
SWIFTBIC BUKBGB22
IBAN GB40 BUKB 2047 3453 2396 99
Mrs Dina Ladnyuk
Download Telegram
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)
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]
What will this code do?
res = [х ** y for х in [2, 3] for y in [2, 3]]
print(res)
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
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
👍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%
Посмотреть результаты