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
In what cases in Python 3 will the answer be an integer?
Anonymous Quiz
6%
8.0 - 3
11%
4/2
71%
7//2
0%
3/2
6%
4 + 1.0
3%
4.5 % 3
3%
See solution
What will this code do?
class MyList(list):
def __iter__(self):
return iter(self*2)
m = MyList([1, 2, 3])
print(list(m))
What will this code do?
from random import randint
num = randint(10**8, 10**20)
s = bin(num)[2:].replace('0', '\n').replace('1', '\t')
print(s.isspace())
What will this code do?
S = "  \t \n  "
S.isalpha() + S.isspace() + S.isdigit() + S.isprintable()
What will this code do?
from math import log
from functools import reduce
f = lambda acc, x: x * acc
gen = (abs(log(i / 10)) for i in range(1, 1000))
print(int(reduce(f, gen, 1)))
What will this code do?
-True % 13 + True % 13
What will this code do?
"I have 10 cars".isalnum()
What will this code do?
"hello".zfill(10)
What will this code do?
import numpy as np
A = np.random.randint(1, 100, size=(5, 5))
B = A.copy()
B[:, [0, -1]] = B[:, [-1, 0]]
d = lambda x: round(np.linalg.det(x))
print(d(A) + d(B))
What will this code do?
"hello" * 0 is '' * 10