Python Tasks & ML | Задачи по питону и машинному обучению
8.88K subscribers
30 photos
1 video
1 file
41 links
Algorithms, functions, classes, regular expressions, iterators, generators, OOP, exceptions, NumPy, pandas, scikit-learn
https://telega.in/c/python_tasks

Questions — @dina_ladnyuk
Download Telegram
Что выведет код?

def f(s):
s.add(4)

a = {1, 2, 3}
f(a)
print(sorted(a))
Что выведет код?

def g():
return set("hello")

s = g()
print(len(s))
Что выведет код?

def combine(a, b):
return a & b

x = {1, 2, 3}
y = {2, 3, 4}
print(combine(x, y))
Что выведет код?

result = [x**2 for x in range(10) if x % 2 == 0]
print(result)
Что выведет код?

result = {len(word) for word in ["hi", "hello", "world", "hi", "code"]}
print(result)
Что выведет код?

words = ["a", "bb", "ccc"]
result = {word: len(word) for word in words}
print(result)
Что выведет код?

matrix = [[1, 2, 3], [4, 5], [6]]
result = [x for row in matrix for x in row if x % 2 == 0]
print(result)
Что выведет код?

numbers = range(5)
result = {x: ('even' if x % 2 == 0 else 'odd') for x in numbers}
print(result)
Что выведет код?

s = "banana"
result = {ch.upper() for ch in s if s.count(ch) == 1}
print(result)
Что выведет код?

from datetime import datetime, timedelta

start = datetime(2025, 12, 31, 23, 0)
delta = timedelta(hours=2)
new_time = start + delta
print(new_time.strftime("%Y-%m-%d %H:%M"))