Created
April 26, 2023 09:00
-
-
Save pinae/efe4d41bdf39bfa0f94e059550f23982 to your computer and use it in GitHub Desktop.
Calculate single numbers from a Fibonacci sequence
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
import sys | |
def fibonacci(n): | |
if n > 1: | |
return fibonacci(n-1) + fibonacci(n-2) | |
else: | |
return n | |
if __name__=="__main__": | |
print(fibonacci(int(sys.argv[1]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment