Заметки Питониста
14.7K subscribers
3.37K photos
18 videos
1.82K links
Все что связано с Python, уже в наших заметках.

Ссылка: @Portal_v_IT

Сотрудничество: @oleginc
Download Telegram
Варианты ответа:
Anonymous Quiz
29%
2
65%
3
6%
5
animals = ['кот', 'собака', 'птица', 'рыба']
animals.pop(1)
animals.insert(2, 'хомяк')
print(animals[-2])


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
61%
хомяк
36%
птица
2%
рыба
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
72%
True
21%
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
52%
A
40%
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
46%
2 1
34%
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
Варианты ответа:
Anonymous Quiz
31%
[1, 4, 5, 2, 3]
34%
[1, 4, 5, 3]
34%
[1, [4, 5], 2, 3]
data = {1: "A", True: "B"}
print(data[1])


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

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


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
34%
2 3
39%
1 2
27%
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
Варианты ответа:
Anonymous Quiz
37%
[0, 1, 2] [0, 1, 2]
55%
[0, 1, 2] []
7%
TypeError
x = "global"
res = [x for x in ["local", "scope"]]
print(x)


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
24%
scope
18%
local
58%
global
class A:
def __new__(cls):
return 42

def __init__(self):
print("Init")

print(A())


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
😱1
Варианты ответа:
Anonymous Quiz
40%
42
35%
Init 42
24%
TypeError