Python & ML tasks
414 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?
ord('5') - ord('2')
What will this code do?
ord('5') + ord('2') == 7
Choose your answer
Anonymous Quiz
32%
True
48%
False
10%
TypeError
10%
See solution
What will this code do?
(lambda: lambda: lambda: lambda: lambda: 1)()()()()()
What will this code do?
(lambda: 1 + lambda: 1 + lambda: 1)()()()
What will this code do?
(lambda: 1 + (lambda: 1 + (lambda: 1)())())()
What do you need to add to make the code work?
class A:
def __init__(self, x):
self.x = x
def __and__(self, other):
return self.x + other.x
a1 = A(1)
a2 = A(2)
# your code
output: 3
What will this code do?
def f(n):
x, y = -n, -n
return x is y
print(f(0), f(5), f(10))
What will this code do?
class A:
def __init__(self, value):
self.value = value
def __call__(self, other):
return self.value ** other
x = A(2)
print(x(3))
What will this code do?
from functools import reduce
funcs = [str.title, lambda x: x*2]
print(reduce(lambda acc, f: f(acc), funcs, 'hello'))
What will this code do?
class A:
def __init__(self, x):
self._x = x
@property
def x(self):
return self._x

a = A(1)
print(A.x.fget(a), a.x)