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

Ссылка: @Portal_v_IT

Сотрудничество: @oleginc
Download Telegram
tpl = ([],)
tpl[0].extend([1, 2])
print(tpl)


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
61%
([1, 2],)
23%
([],)
16%
TypeError
def add_item(num, lst=[]):
lst.append(num)
return lst

add_item(1)
print(add_item(2))


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
15%
[2]
82%
[1, 2]
3%
TypeError
def add_item(num, lst=[]):
lst.append(num)
return lst

add_item(1)
print(add_item(2))


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
17%
[2]
75%
[1, 2]
8%
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
63%
[1, 1, 1]
29%
NameError
8%
AttributeError
x = [1, 2, 3, 4, 5]
x[::2] = [10, 20, 30]
print(x)


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
gen = (x for x in range(5))
print(2 in gen, 2 in gen)


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
19%
True True
76%
True False
5%
False False
gen = (x for x in range(5))
print(2 in gen, 2 in gen)


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
32%
True True
62%
True False
6%
False False
s1 = {1, 2}
s2 = {2, 3}
print(s1 ^ s2)


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
39%
{1, 2, 3}
22%
{2}
39%
{1, 3}
def f(x, y, z):
return x + y + z

d1 = {'x': 1, 'y': 2}
d2 = {'y': 3, 'z': 4}

try:
print(f(**d1, **d2))
except TypeError:
print("TypeError")


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
41%
8
22%
10
37%
TypeError
res = map(lambda x: x * 2, [1, 2])
print(list(res))


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
11%
[1, 2]
83%
[2, 4]
6%
(2, 4)
def f(x, y, z):
return x + y + z

d1 = {'x': 1, 'y': 2}
d2 = {'y': 3, 'z': 4}

try:
print(f(**d1, **d2))
except TypeError:
print("TypeError")


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

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