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 #1495 · Back to latest

Older Posts 20 shown
Post #1494 2.47K
Что выведет код?
def f():
yield 0
yield from [1, 2]
yield 3
print(*f())
  • 👍 1
Post #1492 2.46K
Что выведет код?
values = [8, 3, 1]
group = {2, 7}
def f(values, group):
count = 0
def g(x):
nonlocal count
if x in group:
count += 1
return (0, x)
return(1, x)
values.sort(key=g)
return count
count = f(values, group)
print(count)
  • 👍 2
Post #1491 2.64K
  • 👍 6
  • 💯 1
Post #1490 2.45K
Что выведет код?
def f(x):
if x in group:
return (0, x)
return (1, x)
group = {5, 6, 7}
values = {4, 9, 7, 8, 3, 5}
print(*sorted(values, key=f))
  • 👍 2
Post #1489 3.02K
  • 👍 3
  • 😱 1
Post #1488 2.77K
Что выведет код?
a, b = 1, 0
def divide1(a, b):
try:
return a / b
except ZeroDivisionError:
return None
def divide2(a, b):
try:
return True, a / b
except ZeroDivisionError:
return False, None

print(divide1(a, b), *divide2(a, b))
  • 👨‍💻 5
  • 👍 1
Post #1486 2.56K
Что выведет код?
s = 0
try:
s += 1/0
except ZeroDivisionError:
s += 1
else:
s += 5
finally:
s += 10
print(s)
  • 👍 1
Post #1484 2.5K
Что выведет код?
from itertools import zip_longest
x = [1, 2, 3]
y = ["a", "b"]
l = list(zip(x, y))
m = list(zip_longest(x, y))
print(l == m)
  • 👍 2
Post #1483 2.83K
  • 👍 4
  • 😱 4
Post #1482 2.6K
Что выведет код?
sum(x[0] for x in enumerate(range(2), 5))
  • 👍 1
Post #1481 2.84K
  • 🔥 6
  • 👍 4
Post #1480 2.64K
Что выведет код?
x = [[y**x for y in range(1, 3)] for x in range(1, 3)]
print(x)
  • 👍 5
Post #1477 2.79K
Что выведет код?
x = [*map(lambda x: x**2, [1, 2, 3])]
y = [x**2 for x in range(1, 4)]
print(x == y)
  • 👍 1
Post #1476 3.1K
  • 👨‍💻 7
  • 👏 2
  • 👍 1
  • 😱 1
Post #1475 2.67K
Что выведет код?
def f():
n = 0
def g():
nonlocal n
n += 1
def get():
return n
f.get = get
return g
g1, g2 = f(), f()
g1(), g2(), g1()
print(f.get())
  • 😱 9
  • 👍 1
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 →