updated contents from Atlas repo

This commit is contained in:
Luciano Ramalho
2014-10-14 14:26:55 -03:00
parent 40688c038d
commit 981d5bc473
157 changed files with 71134 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
"""
>>> avg = make_averager()
>>> avg(10)
Traceback (most recent call last):
...
UnboundLocalError: local variable 'num_items' referenced before assignment
"""
def make_averager():
num_items = 0
total = 0
def averager(new_value):
num_items += 1
total += new_value
return total / num_items
return averager