Created
August 23, 2014 13:18
-
-
Save luc99a/dacd680368dc84b083e4 to your computer and use it in GitHub Desktop.
Fibonacci algorithm explained in Python
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
#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