Skip to content

Instantly share code, notes, and snippets.

@dlisboa
Forked from skatenerd/gotcha.py
Last active August 29, 2015 14:12
Show Gist options
  • Save dlisboa/829f3b04922d06367835 to your computer and use it in GitHub Desktop.
Save dlisboa/829f3b04922d06367835 to your computer and use it in GitHub Desktop.
def make_adder():
grand_total = 0
def adder(to_add):
print "Grand total moved from: %s" % grand_total
grand_total += to_add
print "To: %s \n" % grand_total
return grand_total
return adder
adder = make_adder()
adder(1)
adder(2)
adder(3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment