Skip to content

Instantly share code, notes, and snippets.

@luc99a
Created August 23, 2014 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luc99a/dacd680368dc84b083e4 to your computer and use it in GitHub Desktop.
Save luc99a/dacd680368dc84b083e4 to your computer and use it in GitHub Desktop.
Fibonacci algorithm explained in Python
#Explaination of https://github.com/luc99a/Assembly-Codes/blob/master/fibonacci.asm
#In Python
#by luc99a
high = 1 #Store the high number (actually it's not the high number I will swap low and high)
low = 1 #Store the low number (actually it's not the low number I will swap low and high)
#Repeat 20 times
for i in range(0, 20):
temp = low #Store in temp the value of low
low = high #Store in low the value of high
high = temp #Store in high the value of low
#The result is that low and high are swapped
print(str(low)) #Print low
high = high + low #Sum high and low and store in high
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment