Created
December 25, 2020 10:19
-
-
Save zyryc/3df88f9d3cfa2449f25cacd3933e3e49 to your computer and use it in GitHub Desktop.
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
def fib(n): | |
if n<=0: | |
print("invalid input") | |
elif n==1: | |
return 0 | |
elif n==2: | |
return 1 | |
else: | |
return fib(n-1)+fib(n-2) | |
# print(fib(10)) | |
#lets print al the values | |
for n in range(2,11): | |
print(fib(n)) | |
#happy coding !! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment