0
我已經寫了一些代碼來輸出Fibonacci序列兩個第八項:我該如何解決我的錯誤? (輸出「無」)
def fibonacci():
a=1
b=1
print (a)
print (b)
for i in range(0,8):
current= a+b
print (current)
a=b
b=current
它的工作原理,但我的輸出對最終字沒有,爲什麼我收到此錯誤?
1
1
2
3
5
8
13
21
34
55
None
我使它輸出1,1所以我的序列不會在2
你打電話像'print(fibonacci())''也許? – 2013-02-25 18:36:21
刪除函數簽名中的'8',它沒有做任何事情。 – 2013-02-25 18:36:58
8使我的序列輸出8個數字 – 2013-02-25 18:39:38