Python Tasks & ML | Задачи по питону и машинному обучению
Ir al canal en Telegram
Algorithms, functions, classes, regular expressions, iterators, generators, OOP, exceptions, NumPy, pandas, scikit-learn https://telega.in/c/python_tasks Questions — @dina_ladnyuk
Mostrar más8 675
Suscriptores
-224 horas
-57 días
-4230 días
Archivo de publicaciones
Выберите правильный вариант
Что выведет код?
class A:
count = 0
def __init__(self):
A.count += 1
def print_count():
print(A.count)
print_count = staticmethod(print_count)
class B(A): pass
x, y, z = B(), A(), B()
B.print_count()Выберите правильный вариант
Что выведет код?
class A:
count = 0
def __init__(self) :
self.__class__.count += 1
class B(A):
pass
class C(A):
pass
x, y, z = B(), A(), C()
print(A.count, B.count, C.count)Выберите правильный вариант
Что выведет код?
class A:
count = 0
@classmethod
def inc(cls):
cls.count += 1
def __init__ (self):
self.inc()
class B(A):
count = 0
def __init__(self):
A.__init__(self)
class C(A):
count = 0
x = A()
y1, y2 = B(), B()
z1, z2, z3 = C(), C(), C()
print(x.count, y1.count, z1.count)Выберите правильный вариант
Что выведет код?
import random
random.random() < random.randint(1, 10)Выберите правильный вариант
Что выведет код?
(0 or 8 != 11 or 0) + (0 and 8 != 11 and 0)Выберите правильный вариант
Что выведет код?
class counter:
def __init__(self, func):
self.calls = 0
self.func = func
def __call__(self, *args):
self.calls += 1
return self.func(*args), self.calls
@counter
def square(a):
return a ** 2
print(square(2)[0] + square(3)[0] + square(4)[1])Выберите правильный вариант
Что выведет код?
def decorator(cls):
class Proxy:
def __init__ (self, *args):
self.wrapped = cls(*args)
def __getattr__(self, name):
return 1 if name == 'x' else getattr(self.wrapped, name)
return Proxy
@decorator
class S:
def __init__(self, x):
self.x = x
def square(self):
return self.x ** 2
s = S(10)
print(s.square() + s.x)Выберите правильный вариант
Что выведет код?
def counter(func):
def oncall(*args):
oncall.calls += 1
return func(*args) + oncall.calls
oncall.calls = 0
return oncall
class C:
@counter
def square(self, a):
return a ** 2
x = C()
print(x.square(2) + x.square(2))Выберите правильный вариант
Выберите правильный вариант
Что выведет код?
class A: pass
class B:
def __init__(self):
x = super()
print(x is A, x is B)
b = B()
¡Ya disponible! Investigación de Telegram 2025 — los principales insights del año 
