Advertisement
cwchen

specific reminder

Jan 27th, 2014
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. def is_defined_reminder(array, i):
  4.     return array[i - 2] % 10 == 2 and \
  5.            array[i - 1] % 10 == 0 and \
  6.            array[i] % 10 == 1
  7.  
  8. array = list()
  9.  
  10. array.append(2)  # array[0]
  11. array.append(0)  # array[1]
  12. array.append(1)  # array[2]
  13.  
  14. array.append(2 + 0 + 1)  # array[3]
  15. i = 3  # index
  16.  
  17. while(not is_defined_reminder(array, i)):
  18.     array.append(array[i - 2] + array[i - 1] + array[i])
  19.     i += 1
  20.     print i, array[i]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement