All pastes #617135 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-07-13 01:32 UTC
rendered paste body
monthnum = 0
monthone = 0
monthtwo = 0
monththr = 0
children = 0
parents  = 0

def month():
	monthnum = monthnum + 1
	monththr = monthtwo
	monthtwo = monthone
	mothers = parents / 2
	done = 0
	while done<mothers:
		children = children + 8
		done = done + 1
	monthone = children
	children = children - monththr
	parents = parents + monththr
	print "Children: %s Adults: %s Month: %s" % (children, parents, monthnum)
	
month()
print "Done"

Jesus:~/Development/Python andy$ python rats.py 
Traceback (most recent call last):
  File "rats.py", line 22, in <module>
    month()
  File "rats.py", line 9, in month
    monthnum = monthnum + 1
UnboundLocalError: local variable 'monthnum' referenced before assignment