Algorithms, functions, classes, regular expressions, iterators, generators, OOP, exceptions, NumPy, pandas, scikit-learn
https://telega.in/c/python_tasks
Questions — @dina_ladnyuk
Post #1680
2.51K
- 👍 10
- 🔥 5
- 😱 3
PY @python_tasks
Showing posts older than #1682 · Back to latest
def f(x):
if x < 3:
return x
y = filter(f, (0, 1, 2, 3, 4))
print(list(y))
def func(x):
if x >= 3:
return x
y = filter(func, (1, 2, 3, 4))
print(list(y))
x = 5
print([y%2 for y in range(6)][x])
tup = (5, 7, 22, 97)
newtup = tuple(map(lambda x: x + 3, tup))
print(newtup)
def f(p, q):
return p + q
x = list(map(f, ('a', 'b', 'c'), ('x', 'y', 'z')))
print(x[1])
s = list(map(lambda x, y: x + y, [1, 2, 3], [4, 5, 6]))
print(s)
s = list(map(lambda x: x * x, (1, 2, 3, 4)))
print(s)
name = {
124: "A",
444: "B",
952: "C"}
user_id = 375
print(name.get(user_id, "D"))