mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-01-18 16:27:02 +00:00
Create project Euler problem 25 sol2.py (#658)
This commit is contained in:
parent
98a149e41e
commit
74e94ab5e2
10
project_euler/problem_25/sol2.py
Normal file
10
project_euler/problem_25/sol2.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
def fibonacci_genrator():
|
||||
a, b = 0,1
|
||||
while True:
|
||||
a,b = b,a+b
|
||||
yield b
|
||||
answer = 1
|
||||
gen = fibonacci_genrator()
|
||||
while len(str(next(gen))) < 1000:
|
||||
answer += 1
|
||||
assert answer+1 == 4782
|
Loading…
Reference in New Issue
Block a user