hdarwin

cstutoringcenter.com_Fibonacci Sequence V

Jan 2nd, 2013
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.17 KB | None | 0 0
  1. old = 1
  2. new = 1
  3. for x in xrange(998):
  4.     tmp = new
  5.     new = new + old
  6.     old = tmp
  7. sum = 0
  8. for x in str(new):
  9.     if x in ['1','3','5','7','9']:sum += 1
  10. print sum
Advertisement
Add Comment
Please, Sign In to add comment