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
What will this code do?
def f():
def g():
nonlocal x
x = 2
g()
print(x)

f()
📣 Внимание, друзья! 📣

Рады объявить о запуске нового телеграм-канала - HikingEscapades!

💥Мы будем регулярно делиться с вами новыми маршрутами для хайкинга, чтобы вдохновить вас на увлекательные путешествия и незабываемые приключения на природе!

Два раза в месяц по средам в 9 утра будем выкладывать новый маршрут с подробным описанием и фотографиями.

Подписывайтесь на телеграм канал HikingEscapades!
Оставляйте ваши комментарии, делитесь впечатлениями от маршрутов и советуйте друзьям.
What will this code do?
def f():
def g():
global x
x = 2
g()
print(x)

f()
Choose the correct answer
Anonymous Quiz
37%
2
0%
None
37%
SyntaxError
21%
NameError
5%
See solution
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)
What will this code do?
def f():
x = 1
def g():
x += 1
g()
print(x)
print(f())
What will this code do?
def func(а, b):
а = 2
b = b[:]
b[0] = 10

a, b = [0], [1]
func(a, b)
print(a, b)
What will this code do?
def func(a, b):
а = 2
b[0] = 10
x = 1
y = 1, 2
func(x, y)
print(x, y)
The function is given:
def f(a, b, c, d):
print(a, b, c, d)
What will this code do?
x = 1
def f():
def g():
nonlocal x
print(x)
x += 1
return g