Python | Тесты для программистов
15.3K subscribers
3.31K photos
10 videos
1.58K links
Ежедневный чек-ап знаний

Ссылка: @Portal_v_IT

Сотрудничество: @oleginc, @tatiana_inc

Канал на бирже: telega.in/c/pythontest_it

РКН: clck.ru/3KHeRe

#ROLCV
Download Telegram
print(isinstance(True, int))


💕 Наш уютный чатик

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
60%
True
29%
False
11%
TypeError
class MetaCounter(type):
instances = 0

def __call__(cls, *args, **kwargs):
MetaCounter.instances += 1
return super().__call__(*args, **kwargs)

class A(metaclass=MetaCounter):
pass

class B(A):
pass

a1, a2 = A(), A()
b1 = B()
print(MetaCounter.instances)


💕 Наш уютный чатик

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
30%
2
63%
3
7%
5
animals = ['кот', 'собака', 'птица', 'рыба']
animals.pop(1)
animals.insert(2, 'хомяк')
print(animals[-2])


💕 Наш уютный чатик

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
69%
True
22%
False
8%
None
class Context:
def __enter__(self):
return "A"
def __exit__(self, *args):
return True

with Context() as c:
raise ValueError()

print(c)


💕 Наш уютный чатик

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
51%
A
41%
ValueError
8%
None
def make_counter():
count = 0
def increment():
nonlocal count
count += 1
return count
return increment

c1 = make_counter()
c2 = make_counter()
c1()
print(c1(), c2())


💕 Наш уютный чатик

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
44%
2 1
36%
2 2
20%
1 1
a = [1, 2, 3]
a[1:1] = [4, 5]
print(a)


💕 Наш уютный чатик

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
data = {1: "A", True: "B"}
print(data[1])


💕 Наш уютный чатик

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
38%
A
49%
B
12%
KeyError
print(round(1.5), round(2.5))


💕 Наш уютный чатик

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
36%
2 3
40%
1 2
24%
2 2
gen = (x for x in range(3))
a = list(gen)
b = list(gen)
print(a, b)


💕 Наш уютный чатик

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
x = "global"
res = [x for x in ["local", "scope"]]
print(x)


💕 Наш уютный чатик

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM