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?
"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
What should be written in class C instead of 'pass' so that the output is False?
Anonymous Quiz
0%
a = 1
6%
del __dict__
18%
del self.__dict__
24%
__slots__ = ['a']
29%
def __init__(self): del self.__dict__
24%
See solution
What will this code do?
sum((pow(3, 3, 2), pow(2, 3, 7)), 1)
What will this code do?
class X: pass
class Y: pass
class A(X): pass
class B(Y): pass
class D(A, B): pass
print([cls.__name__ for cls in D.__mro__])