Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x, y = 0, 1
- a = []
- while 1:
- if x % 2 == 0:
- if x >= 4000000:
- break;
- else:
- a.append(x)
- x, y = y, x + y
- for n in a:
- print str(n) + "\n"
- print 'total: ' + str(sum(a))
- masticore@ubuntu:~/portfolio/python/projecteuler$ python 2.py
- 0
- 2
- 8
- 34
- 144
- 610
- 2584
- 10946
- 46368
- 196418
- 832040
- 3524578
- sum: 4613732
Add Comment
Please, Sign In to add comment