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

Ссылка: @Portal_v_IT

Сотрудничество: @oleginc
Download Telegram
def calculate(x, y):
if x > y:
return x - y
else:
return y - x

result = calculate(10, 15) + calculate(20, 8)
print(result)


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
69%
17
22%
7
9%
25
class A:
x = 1

class B(A):
pass

class C(A):
pass

B.x = 2
A.x = 3

print(C.x)


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
35%
1
27%
2
37%
3
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]
7%
(2, 4)
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
Варианты ответа:
Anonymous Quiz
51%
42
32%
Init 42
17%
TypeError
d = {'a': 1, 'b': 2, 'c': 3}
try:
for k in d:
del d[k]
print(len(d))
except RuntimeError:
print("RuntimeError")


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
21%
0
65%
RuntimeError
14%
KeyError
tpl = ([],)
tpl[0].extend([1, 2])
print(tpl)


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
71%
([1, 2],)
20%
([],)
10%
TypeError
x = [0, 1]
i = 0
i, x[i] = 1, 2
print(x)


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
31%
[2, 1]
57%
[0, 2]
12%
[2, 0]
def calculate(x, y):
if x > y:
return x - y
else:
return y - x

result = calculate(10, 15) + calculate(20, 8)
print(result)


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
64%
17
27%
7
9%
25
def increment(x):
x += 10
return x

value = 5
new_value = increment(value)
print(value + new_value)


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
63%
20
25%
25
13%
15
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
Варианты ответа:
Anonymous Quiz
47%
42
40%
Init 42
14%
TypeError
data = {'a': [1, 2], 'b': [3, 4]}
data['c'] = data['a'] + data['b']
data['a'].append(5)
print(len(data['c']))


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

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