TGViewer
Channel Public Channel
Python Tasks & ML | Задачи по питону и машинному обучению

Python Tasks & ML | Задачи по питону и машинному обучению

@python_tasks

Algorithms, functions, classes, regular expressions, iterators, generators, OOP, exceptions, NumPy, pandas, scikit-learn
https://telega.in/c/python_tasks

Questions — @dina_ladnyuk
Subscribers
8.51K
Photos
30
Videos
1
Links
41

Showing posts older than #2742 · Back to latest

Older Posts 20 shown
Post #2741 781
Что выведет код?
def f():
setattr(f, "x", getattr(f, "x", 0) + 1)
f.f = f
return f
x = f()()().f.f.f().f.x
print(x)
Post #2739 817
Что выведет код?
class C:
listing = []

x = C()
x.listing.append(1)
x.listing.append(1)
x.listing = 1
print(x.listing, C.listing)
Post #2737 848
Дан код:
d = {}
d[2, 3] = "a", "b"
Post #2735 878
Что выведет код?
class A:
x = 1
l = []
a1, a2 = A(), A()
a1.x = 2
a1.l.append(100)
print(a2.x, len(a2.l))
  • 👍 1
Post #2733 759
Что выведет код?
class A:
def f(self):
print("A", end="")
class B(A):
def f(self):
print("B", end="")
super().f()
A.f(self)
class C(A):
def f(self):
print("C", end="")
super().f()
A.f(self)
class D(B, C):
def f(self):
print("D", end="")
super().f()
d = D()
d.f()
Post #2731 737
Что выведет код?
class B:
def __init__(self) :
print ('В', end='')
super().__init__()
class C:
def __init__(self):
print('C', end='')
super().__init__ ()
class D(B, C):
def __init__(self):
print('D', end='')
B.__init__(self)
C.__init__(self)
X = D()
Post #2729 819
Что выведет код?
class A:
def f(self):
print('A', end="")
class B:
def f(self):
print('B', end="")
class C(A):
def f(self):
print("C", end="")
super().f()
self.__class__.__bases__ = (B,)
x = C()
_ = x.f(), x.f()
Post #2727 826
Что выведет код?
x = [0, None]
y = ["abc", 1]
s = (any(x), any(y)) == (all(x), all(y))
print(s)
Post #2725 856
Что выведет код?
x = [0, None, 1]
y = []
s = (any(x), any(y)) == (all(y), all(x))
print(s)
Post #2723 762
Что выведет код?
s = [1, 2, 1, 1, 1, 3]
print(s.count(1) + s.index(2))
Older posts →
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →