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

Ссылка: @Portal_v_IT

Сотрудничество: @oleginc
Download Telegram
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
val = 10

def update():
global val
val = 20
del val

update()

try:
print(val)
except NameError:
print("NameError")


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
19%
10
33%
20
48%
NameError
def swap(a, b):
return b, a

x, y = 10, 20
x, y = swap(x, y)
x, y = swap(y, x)
print(x + y)


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
75%
30
25%
40
0%
20
x = 1

def func():
x = 2
print(globals()['x'])

func()


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
49%
1
32%
2
18%
KeyError
👍1
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
43%
[0, 6]
37%
[0, 2, 3, 4, 6, 8, 9]
20%
SyntaxError
print(-11 % 3, 11 % -3)


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
32%
1 -1
47%
-2 2
21%
-2 -2
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
32%
1
33%
2
35%
3
val = 10

def update():
global val
val = 20
del val

update()

try:
print(val)
except NameError:
print("NameError")


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
23%
10
20%
20
57%
NameError
❤1
def func(a, b, c, d):
return a + b * c - d

args = [2, 3]
kwargs = {'c': 4, 'd': 5}
result = func(*args, **kwargs)
print(result)

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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
69%
9
26%
14
5%
7
class Point:
__slots__ = ['x', 'y']

p = Point()
p.x = 1
p.z = 2
print(p.x)


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
❤2
Варианты ответа:
Anonymous Quiz
34%
1
22%
None
44%
AttributeError
colors = ['red', 'green', 'blue']
colors.insert(1, colors.pop())
colors.reverse()
print(colors[0])


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

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