Last active
August 17, 2017 15:38
-
-
Save cy-xu/73f1253270cf9c1573552836273f6969 to your computer and use it in GitHub Desktop.
MAT Survey Fibonacci
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
def fiboNumberList(howMany): | |
startNumber = 1 | |
nextNumber = 0 | |
countNumber = 0 | |
fiboList = [] | |
if howMany%1 != 0 or howMany < 1: | |
print("Positive integer please!") | |
else: | |
while countNumber < howMany: | |
nextNumber = startNumber + nextNumber | |
startNumber = nextNumber - startNumber | |
fiboList.append(nextNumber) | |
countNumber += 1 | |
return fiboList | |
print(fiboNumberList(100)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Karl,
I realized that the first number should be 0 instead of 1 when I wanted to check the 100th number. But this is what I got if not googling online, I don't want to hide this mistake. Thank you.
See you soon in school!
Best,
CY