S
SherjilOzair
def adder():
s = 0
def a(x):
s += x
return sum
return a
pos, neg = adder(), adder()
for i in range(10):
print pos(i), neg(-2*i)
This should work, right? Why does it not?
Checkout slide no. 37 of a Tour of Go to know inspiration. Just wanted to see if python was the same as Go in this regard. Sorry, if I'm being rude, or anything.
s = 0
def a(x):
s += x
return sum
return a
pos, neg = adder(), adder()
for i in range(10):
print pos(i), neg(-2*i)
This should work, right? Why does it not?
Checkout slide no. 37 of a Tour of Go to know inspiration. Just wanted to see if python was the same as Go in this regard. Sorry, if I'm being rude, or anything.