Skip to content

Instantly share code, notes, and snippets.

@sujyrokimora
Created September 26, 2024 16:01
Show Gist options
  • Select an option

  • Save sujyrokimora/c34f06084abe6bb2552d23a2c1dd0eeb to your computer and use it in GitHub Desktop.

Select an option

Save sujyrokimora/c34f06084abe6bb2552d23a2c1dd0eeb to your computer and use it in GitHub Desktop.
import time
from turtledemo.penrose import start
num1 = 0
num2 = 1
next_number = num2
def fibonacci(n):
global next_number, num2, num1
count = 1
while count <= n:
#print(next_number, end=" ")
#print("\n")
count += 1
num1, num2 = num2, next_number
next_number = num1 + num2
def main():
startTime=time.time()
fibonacci(int(input("How many numbers?")))
endTime=time.time()
print("Done in only ",endTime-startTime," seconds!")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment