Python & ML tasks
414 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?
import numpy as np
a = np.array([[101, 99],[102, 98]])
print(np.max(a))
What will this code do?
x = 5
print([y%2 for y in range(6)][x])
Choose your answer
Anonymous Quiz
24%
0
35%
1
21%
5
9%
None
12%
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))
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)
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))
What will this code do?
import numpy as np
a = np.array([1, 2, 3])
print(np.dot(a, a.T))