Skip to content

Instantly share code, notes, and snippets.

@cy-xu
Last active August 17, 2017 15:38
Show Gist options
  • Save cy-xu/73f1253270cf9c1573552836273f6969 to your computer and use it in GitHub Desktop.
Save cy-xu/73f1253270cf9c1573552836273f6969 to your computer and use it in GitHub Desktop.
MAT Survey Fibonacci
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))
@cy-xu
Copy link
Author

cy-xu commented Aug 17, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment