mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-05-02 06:46:18 -04:00
reorganize dir
Signed-off-by: Mia Steinkirch <mia.steinkirch@gmail.com>
This commit is contained in:
parent
1b6f705e7c
commit
a8e71c50db
276 changed files with 23954 additions and 0 deletions
18
other_resources/Project-Euler/002-even_fib_num.py
Normal file
18
other_resources/Project-Euler/002-even_fib_num.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
|
||||
def even_fib_num(limit):
|
||||
a, b = 0, 1
|
||||
while a < limit:
|
||||
yield a
|
||||
a, b = b, a + b
|
||||
|
||||
def main():
|
||||
print(sum(n for n in even_fib_num(4e6) if not (n & 1)))
|
||||
print('Tests Passed!')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue