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?
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
What will this code do?
True + ~False
What will this code do?
None or False and True
What will this code do?
bin(2**2) == bin(2**3 >> 1),  bin(2**2) is bin(2**3 >> 1)
Given code
class C: pass
class D (C): __slots__ = ['a']
X = D()
X.a = 1
print(hasattr(X, '__dict__'))

output - True