Python : 3.7.0
OS : Ubuntu 18.04.1 LTS
IDE : PyCharm 2018.2.4
Conda : 4.5.11
typesetting : Markdown
code
"""
@Author : 行初心
@Date : 18-9-24
@Blog : www.cnblogs.com/xingchuxin
@Gitee : gitee.com/zhichengjiu
"""
def f(n):
n1 = 1
n2 = 1
n3 = 1
if n < 1:
print('输入有误')
return -1
while (n - 2) > 0:
n3 = n2 + n1
n1 = n2
n2 = n3
n = n - 1
return n3
def main():
res = f(98)
print(res)
if __name__ == '__main__':
main()
result
/home/coder/anaconda3/envs/py37/bin/python /home/coder/PycharmProjects/basic/demo.py
135301852344706746049
Process finished with exit code 0