Заметки Питониста
14.8K subscribers
3.35K photos
17 videos
1.79K 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
Варианты ответа:
Anonymous Quiz
52%
42
31%
Init 42
17%
TypeError
class A:
def __init__(self):
self.__x = 1

def get_x(self):
return self.__x

class B(A):
def __init__(self):
super().__init__()
self.__x = 2

b = B()
print(b.get_x())


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
29%
1
59%
2
12%
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
57%
[0, 6]
29%
[0, 2, 3, 4, 6, 8, 9]
14%
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
36%
16
64%
33
0%
21
a = [[1, 2], [3, 4]]
b = list(a)
a[0][1] = 5
print(b[0][1])


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
69%
5
23%
2
8%
IndexError
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
42%
[1, 1, 1]
44%
NameError
14%
AttributeError
a = [[1, 2], [3, 4]]
b = list(a)
a[0][1] = 5
print(b[0][1])


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

#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
57%
5
38%
2
5%
IndexError
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
20%
[2]
75%
[1, 2]
5%
TypeError
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
28%
1
25%
2
47%
3
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
24%
[0, 1, 2] [0, 1, 2]
68%
[0, 1, 2] []
8%
TypeError
def modify(n):
n = n + 5
n *= 2
return n

x = 10
result = modify(x) + x
print(result)


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

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