Created
April 28, 2016 09:21
-
-
Save seniorpreacher/87e0b98e3d034f0bd27ba5f0d5ec08ca to your computer and use it in GitHub Desktop.
Python - Fibonacci examples
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
number_count = 30 | |
list = [0, 1] | |
for i in range(0, number_count - 2): | |
list.append(list[-1] + list[-2]) | |
for j in list: | |
print j |
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
number_count = 30 | |
a, b = 0, 1 | |
print a, "\n", b | |
for i in range(0, number_count - 2): | |
a, b = b, a + b | |
print b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment