所以我尝试使用input
号码打印斐波那契序列。我不知道如何在我的代码中输入数字。从输入号码打印斐波那契
def fibonacci(n):
a,b=0,1
while(a<n):
print(a,end=' ')
a,b=b,a+b
print()
fibonacci(fibo_entry=input("enter number"))
我得到这个错误:
TypeError Traceback (most recent call last)
<ipython-input-113-d552685b93df> in <module>()
7 a,b=b,a+b
8 print()
----> 9 fibonacci(fibo_entry=input("enter number"))
TypeError: fibonacci() got an unexpected keyword argument 'fibo_entry'
非常感谢!显式方法起作用并且看起来很简单。 –
@KrithikaKrishnan没问题。请不要忘记[接受](http://stackoverflow.com/help/accepted-answer)/ upvote有用的答案。 :) – MSeifert
嗨@KrithikaKrishnan *如果*答案解决了您的问题,如您所示,请考虑接受答案(在左侧上/下箭头下方勾选大“V”)。这是指出答案适用于您的适当方式,并增加您未来可以获得良好答案的机会。 –