Created
May 19, 2018 21:59
-
-
Save accessnash/f649e6a1edb67aa2f16909fab90425bd to your computer and use it in GitHub Desktop.
sum of even fibonacci numbers less than 4 millions - problem from Project Euler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fiblist = [] | |
| a,b=1,2 | |
| while b < 8000001: | |
| fiblist.append(a) | |
| a,b = b,a+b | |
| print(fiblist) | |
| newlist = [] | |
| for num in fiblist: | |
| if num % 2 ==0: | |
| newlist.append(num) | |
| print(newlist) | |
| print(sum(newlist)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment