Guest User

Untitled

a guest
Jan 3rd, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. class cow(object):
  2.     def __init__(self):
  3.         self.age = 0
  4.        
  5. parent = cow()
  6.  
  7. cows = [parent]
  8. tmp_cows = []
  9.  
  10.  
  11. for i in xrange(1, 21):
  12.     for cow in cows:
  13.         cow.age += 1
  14.         if cow.age >=  3:
  15.             tmp_cows.append(cow())
  16.    
  17.     cows += tmp_cows
  18.     tmp_cows = []
  19.        
  20.     print "%d %d" % (i, len(cows))
  21.  
  22. print len(cows)
Advertisement
Add Comment
Please, Sign In to add comment