Python & ML tasks
415 subscribers
2 photos
3 links
Python, functions, classes, iterators, generators, numpy, pandas, scikit-learn, TensorFlow
for advertising: @dina_ladnyuk

For advertising and donations in USD:
SWIFTBIC BUKBGB22
IBAN GB40 BUKB 2047 3453 2396 99
Mrs Dina Ladnyuk
Download Telegram
What will this code do?
print(sorted([str(x) for x in range(1, 30, 5)]))
What will this code do?
print(2 ^ 3 ^ 3 ^ 2 ^ 2 ^ 4 ^ 2 ^ 4 ^ 2)
Choose your answer
Anonymous Quiz
28%
0
7%
1
18%
2
0%
3
0%
4
5%
7
43%
See solution
What will this code do?
a = 0
def func():
global a
for num in [2, 4, 8]:
a += 1
yield(num * 0.5)

array = []
for val in func():
array.append(int(a == val))
print(sum(array))
👍1
What will this code do?
a = 1; b = 2
print(eval('print(a + b, end=" ") or 0'))
Given code
class A:
x = 1
def __init__(self):
self.y = 2

a = A()
What will this code do?
class A:
def __iter__(self):
yield from range(10)
a = A()
print(5 in a, 20 in a)
What will this code do?
def g(f1, f2, x):
return f1(x) + f2(x) if x else 0
f1, f2 = lambda x: x**3/abs(x), lambda x: x % 2
x = 121
g(f1, f2, -x) + g(f1, f2, x)
What will this code do?
import re
sent = 'Hello, Ben! How are you doing?'
lister = filter(None, re.split("[,!?]+", sent))
print(len(list(lister)))
👍1🤯1
Given code
def f(n):
def g(x):
return x ** n
return g

g = f(3)
print(g(2), g(3))
What will this code do?
from itertools import product
a = [1, 2]
b = [3, 4]
sum(sum(product(a, b), (0, 0)))