Заметки Питониста
14.8K subscribers
3.35K photos
17 videos
1.8K links
Все что связано с Python, уже в наших заметках.

Ссылка: @Portal_v_IT

Сотрудничество: @oleginc
Download Telegram
Забрать подписки на сервисы можно на ggsel ⚾️

На сайте собраны подписки на YT Premium, Spotify, нейронки и другой софт ☕️

Иностранные карты для оплаты не потребуются — на ggsel все безопасно оплачивается с обычных карт российских банков 🫰
Please open Telegram to view this post
VIEW IN TELEGRAM
lst = [10, 20, 30, 40, 50]
del lst[1::2]
print(lst)


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
54%
[10, 30, 50]
38%
[20, 40]
8%
TypeError
gen = (x for x in range(3))
print(list(gen), list(gen))


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
41%
[0, 1, 2] [0, 1, 2]
55%
[0, 1, 2] []
5%
TypeError
keys = ['a', 'b', 'c']
vals = [1, 2]
d = {k: v for k, v in zip(keys, vals)}
print(d)


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
res = map(lambda x: x * 2, [1, 2])
print(list(res))


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
13%
[1, 2]
78%
[2, 4]
9%
(2, 4)
gen = (x for x in range(3))
print(list(gen), list(gen))


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
37%
[0, 1, 2] [0, 1, 2]
54%
[0, 1, 2] []
9%
TypeError
class Model:
val = 1
lst = [val for _ in range(3)]

print(Model.lst)


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
52%
[1, 1, 1]
40%
NameError
8%
AttributeError
lst = [x for x in range(10) if x % 2 == 0 if x % 3 == 0]
print(lst)


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
56%
[0, 6]
27%
[0, 2, 3, 4, 6, 8, 9]
16%
SyntaxError
def modify(x, y=[]):
y.append(x)
return sum(y)

result = modify(5) + modify(7) + modify(4)
print(result)


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
40%
16
56%
33
5%
21
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
45%
2 1
37%
2 2
18%
1 1
x = [1, 2]
def f():
x += [3]

try:
f()
except UnboundLocalError:
print("Error")


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
42%
[1, 2, 3]
47%
Error
12%
TypeError