Python & ML tasks
415 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
print(np.uint8(1 - 2))
What will this code do?
import numpy as np
mat = np.array([[1, 2], [4, 5]])
print(round((mat @ np.linalg.inv(mat)).sum()))
Choose the right option for "callables"
class A:
def __init__(self, x):
self.x = x
def __call__(self):
return self.x
class B:
def __init__(self, x):
self.x = x
def method(self):
return self.x
class C:
def __init__(self, x=3):
self.x = x
def __repr__(self):
return str(self.x)
a = A(1)
b = B(2)
c = C(3)
callables = # your code
print([act() for act in callables])
#Output [1, 2, 3]
What will this code do?
import numpy as np
A = np.arange(9).reshape(-1, 3)
print(np.linalg.det(A))
👍2
What design pattern is used in this code?
class A: pass
class B: pass
def f(cls, *args):
return cls(*args)
a = f(A)
b = f(B)
What will this code do?
-2 % 9
Choose your answer
Anonymous Quiz
41%
-2
12%
2
2%
5
29%
7
3%
9
14%
See solution
👍2
What needs to be added for the output to be True?
from abc import ABC
class L(ABC): pass
# your code
print(issubclass(tuple, L))
What will this code do?
-7 % 3 + 7 % 3
Choose your answer
Anonymous Quiz
22%
-1
41%
0
2%
1
31%
3
2%
7
2%
See solution
What will this code do?
print(isinstance(True, int), isinstance(True, bool))
What will this code do?
S = 'Hello, Max!'.isalnum()
try:
10/S
except:
print('Buy, Max')
else:
print('See you tomorrow')