Что выведет код?
x = [0, None]
y = ["abc", 1]
s = (any(x), any(y)) == (all(x), all(y))
print(s)
Что выведет код?
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()
Выберите правильный вариант
Anonymous Quiz
26%
CABCAB
13%
CACA
25%
CBCB
27%
CACB
4%
CBCA
5%
Посмотреть результаты
Что выведет код?
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()
Выберите правильный вариант
Anonymous Quiz
8%
DB
7%
DC
51%
DBC
13%
DBBC
17%
DBCC
1%
DCBC
3%
Посмотреть результаты
Что выведет код?
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()
Выберите правильный вариант
Anonymous Quiz
13%
DBACA
16%
DBACAA
15%
DBCA
18%
DBCAA
18%
DBCAAA
10%
DBAACA
9%
Посмотреть результаты
Что выведет код?
class A:
x = 1
l = []
a1, a2 = A(), A()
a1.x = 2
a1.l.append(100)
print(a2.x, len(a2.l))
Выберите правильный вариант
Anonymous Quiz
22%
1 0
24%
1 1
16%
2 0
17%
2 1
15%
1 100
5%
Посмотреть результаты
Дан код:
d = {}
d[2, 3] = "a", "b"
Как получить вывод "ab"?
Anonymous Quiz
13%
print(d[0], d[1])
31%
print(d[2], d[3])
28%
print(*d[2,3])
17%
print(**d[2,3])
11%
Посмотреть результаты
Что выведет код?
class C:
listing = []
x = C()
x.listing.append(1)
x.listing.append(1)
x.listing = 1
print(x.listing, C.listing)
Выберите правильный вариант
Anonymous Quiz
13%
1[1]
13%
[1][1]
45%
1[1,1]
22%
[1,1]1
1%
[1,1][1,1]
7%
Посмотреть результаты
Что выведет код?
def f():
setattr(f, "x", getattr(f, "x", 0) + 1)
f.f = f
return f
x = f()()().f.f.f().f.x
print(x)
Выберите правильный вариант
Anonymous Quiz
10%
1
8%
2
19%
3
28%
4
5%
5
9%
TypeError
8%
AttributeError
5%
ValueError
10%
Посмотреть результаты
Как получить доступ к скрытому атрибуту __x?
Anonymous Quiz
7%
a.x
36%
a.__x
11%
a.A__x
10%
a.A.__x
15%
a._A__x
7%
a._A.__x
4%
a.__A__x
5%
a.__A.__x
2%
a.__x_A
1%
a.__x._A
Что выведет код?
class A:
__x = 1
def f(self):
return "f from A"
def g(self):
return "g from A"
class B:
__x = 2
def f(self):
return "f from B"
def g(self):
return "g from B"
class C(A, B):
f = B.f
c = C()
print(c.f(), c.g(), c._A__x, c._B__x)