Created
November 15, 2021 21:42
-
-
Save YannickSF/e24383d03c766b1d1bde12c174b09590 to your computer and use it in GitHub Desktop.
fibonacci algorithm
This file contains 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
I0 = 0 | |
I1 = 1 | |
def fibonacci(high): | |
results = [I0, I1] | |
[results.append(results[v] + results[v + 1]) for v in range(high)] | |
return results | |
def fibonacci_factor(initial_value, high): | |
high_fibonacci = fibonacci(high) | |
return [initial_value * high_fibonacci[w] for w in range(high)] | |
if __name__ == '__main__': | |
# for i in fibonacci(10): | |
for i in fibonacci_factor(180, 10): | |
print(i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment