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.5K
Photos
30
Videos
1
Links
41

Showing posts older than #1961 · Back to latest

Older Posts 20 shown
Post #1960 1.77K
Что выведет код?
def f(*args):
result = []
for x in args[0]:
for word in args[1:]:
if x not in word:
break
else:
result.append(x)
return ''.join(result)
s1, s2, s3= "message", "massage", "mask"
print(f(s1, s2, s3))
Post #1958 2.18K
  • 👍 3
  • 😱 3
Post #1957 1.9K
Что выведет код?
def f(*args):
result = []
for x in args[0]:
if x in result:
continue
for word in args[1:]:
if x not in word:
break
else:
result.append(x)
return ''.join(result)
s1, s2, s3= "message", "massage", "mask"
print(f(s1, s2, s3))
  • 👍 5
Post #1955 1.85K
Что выведет код?
def mintwo(*args):
tmp = list(args)
tmp.sort()
return tmp[0], tmp[1]
data = [8, -4, 5, -2, 9, 3, -98]
print(*mintwo(*data))
  • 👍 1
Post #1953 1.9K
Что выведет код?
def f(transform, *args):
res = args[0]
for arg in args[1:]:
res = transform(res, arg)
return res

data = [-4, 2, -1, 5, -6, 3]
func = lambda x, n: x * (-1)**n
print(int(f(func, *data)))
Post #1952 2.27K
  • 👨‍💻 13
  • 👍 1
Post #1951 1.79K
Что выведет код?
def f(test, *args):
res = []
for arg in args:
if test(arg):
res.append(arg)
return sum(res)
data = [-4, 2, -1, 5, -6, 3]
negative = lambda x: x < 0
neg = f(negative, *data)
positive = lambda x: x > 0
pos = f(positive, *data)
print(neg, pos)
Post #1949 2.05K
Что выведет код?
def maker(f, args, kwargs):
return 1 + f(*args, **kwargs)
m1 = maker(lambda a, b: a + b, (5, ), {"b": 2})
m2 = maker(lambda a, b: a * b, [4, 5], {})
print(m1 + m2)
  • 👍 4
Post #1947 2.22K
Что выведет код?
def f(s:str = "1") -> int:
return s * 2
print(f(), isinstance(f(), int))
  • 👍 1
Post #1945 2.01K
Что выведет код?
def f(a, b, c, d, e):
print(a, b, c, d, e)

f(1, *(3,), c=10, **{"d": 5, "e": 100})
Post #1943 2.01K
Что выведет код?
x = 1
def f():
def g():
nonlocal x
print(x)
x += 1
return g
Post #1941 2.54K
  • 😱 2
  • 🤓 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 →