Python & ML tasks
416 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
The entry point to the program is the runmod.py module.
What will be the output?
Anonymous Quiz
10%
0
20%
1
20%
2
30%
3
0%
10
0%
11
10%
12
0%
13
10%
See solution
What will this code do?
def maker(n):
s = 0
def g(x=n):
nonlocal s
s += x
return s
return lambda x: s + x + g()
f = maker(2)
print(f(3), f(3))
What will this code do?
f = lambda x, f=(lambda x: x**2):  f(x)
print(f(5), f(5, f))
What will this code do?
a = "Xmas"
b = a
a = "New Year"
print((a is b))
Choose your answer
Anonymous Quiz
35%
True
58%
False
4%
TypeError
4%
See solution
What will this code do?
def maker(n, h=lambda: 3):
return lambda f=h: f()**n, lambda f=h: n**f()
f, g = maker(2)
r = f(g) + g(f)
print(r)
What will this code do?
funcs = [lambda x: x**i for i in range(2, 4)]
print(funcs[0](5))
What will this code do?
def f():
def g():
nonlocal x
x = 2
g()
print(x)

f()
👍1
👍1
What will this code do?
def f():
def g():
global x
x = 2
g()
print(x)

f()
What will this code do?
def f(name="", value=0):
import sys
func_name = sys._getframe(0).f_code.co_name
func = sys._getframe(1).f_locals[func_name]
setattr(func, name, value)
return sum(func.__dict__.values())

print(f("x", 1), f("y", 2), f())
What will this code do?
a = b, c = [1, 2]
a[0] = 10
print(b, c)