Initial commit: Python learning project with examples and exercises
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
#5.6.3
|
||||
def fib(n):
|
||||
if n==1 or n==2:
|
||||
return 1
|
||||
elif n>2:
|
||||
return fib(n-1)+fib(n-2)
|
||||
else:
|
||||
return "斐波那契数列输入错误!请重新输入"
|
||||
|
||||
a = int(input())
|
||||
print(fib(a))
|
||||
Reference in New Issue
Block a user