TGViewer
Channel Public Channel
Python Tasks & ML | Задачи по питону и машинному обучению

Python Tasks & ML | Задачи по питону и машинному обучению

@python_tasks

Algorithms, functions, classes, regular expressions, iterators, generators, OOP, exceptions, NumPy, pandas, scikit-learn
https://telega.in/c/python_tasks

Questions — @dina_ladnyuk
Subscribers
8.49K
Photos
30
Videos
1
Links
41

Showing posts older than #1039 · Back to latest

Older Posts 20 shown
Post #1038 3.31K
Что выведет код?
avg = lambda x: sum(x) / len(x)
def f(values):
a, *b, c = values
return avg(b)
f([0, 2, 3, 4])
Post #1036 3.87K
Что выведет код?
import heapq
s = [2, 3, 0, 1]
heapq.heapify(s)
print(s[-1])
Post #1034 3.86K
Что выведет код?
import heapq
s = [2, 1, 3]
heapq.heapify(s)
print(s[0])
Post #1031 3.51K
Что выведет код?
import heapq
d = [5, -2, 3, 4, 1, 7 -3, 11, -9, 0, -1, 6]
a = heapq.nsmallest(1, d)
b = heapq.nlargest(1, d)
print(*a, *b)
Post #1027 3.77K
from collections import deque
q = deque(maxlen=3)
q.append(1)
q.appendleft(2)
q.append(3)
q.append(4)
q.popleft()
print(q.popleft())
Post #1023 3.62K
Что выведет код?
a, b, *c, d = (1,2,3,4,5,6)
print(c)
Post #1020 3.43K
Что выведет код?
class A:
def __init__(self):
self.i = 0
def __iter__(self):
return self
def __next__(self):
if self.i > 2:
raise StopIteration
self.i += 1
return self.i
a, b, c = A()
print(a, b, c)
Post #1016 3.15K
Что выведет код?
def f():
yield 1
yield 2
yield 3
a, *b = f()
print(a, b)
Post #1013 3.22K
Что выведет код?
with open('sample.txt', "w") as file_object:
a = file_object.closed
b = file_object.closed
print(a, b)
Post #1011 3.22K
Что выведет код?
L = ['abc' , [(1, 2) , ([3] , 4)] , 5]
L[1][1][0][0]
Older posts →
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →