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 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')
What will this code do?
"".join(chr(i) if i % 2 else chr(i).upper() for i in range(ord('a'), ord('e')))
What will this code do?
False ** False + True * 2 + ([] or (True + False))
What will this code do?
import numpy as np
a = np.array([1, 2, 3])
b = np.array([4, 5, 6])
c = a + b
c = c * a
print(c[1])
🤩1
Choose your answer
Anonymous Quiz
4%
4
29%
5
6%
7
2%
9
48%
14
6%
27
4%
See solution
👍1
What will this code do?
def f(n):
s = 0
for i in range(n):
s += i
s += ~i
return s
print(f(1) + f(10) + f(100))
🤩1
What will this code do?
-453492 % 101 + 453492 % 101
👍2
Which of the classes from the scikit-learn library does NOT solve the problem of regression?
Anonymous Quiz
17%
DecisionTreeRegressor
20%
RandomForestRegressor
20%
LinearRegression
37%
LogisticRegression
7%
See solution
👍1
What will this code do?
class MyList(list):
def __getitem__(self, index):
if type(index) is slice:
index = slice(index.start - 1, index.stop - 1, index.step)
elif type(index) is int:
index -= 1
return list.__getitem__(self, index)

l = MyList(["one", "two", "three", "four", "five", "six"])

print(l[1], l[-1], l[0], l[2:4])