Ghostly Python
👩💻 Викторина: что выведет код?
def make_counter():
count = [0]
def increment():
count[0] += 1
return count[0]
def get():
return count[0]
return increment, get
inc1, get1 = make_counter()
inc2, get2 = make_counter()
inc1()
inc1()
inc2()
inc1()
print(get1(), get2())
print(inc2())
print(get1(), get2())
🐍 Ghostly Python | #викторина
💩9😁2🤮1
4 · 3.3K ·