python求斐波那契数列前20项
作者:野牛程序员:2023-11-22 10:56:25python阅读 2409
python求斐波那契数列前20项 :
# 生成斐波那契数列前20项的代码 fibonacci_sequence = [0, 1] for _ in range(18): next_term = fibonacci_sequence[-1] + fibonacci_sequence[-2] fibonacci_sequence.append(next_term) # 输出结果 print(fibonacci_sequence)
野牛程序员教少儿编程与信息学奥赛-微信|电话:15892516892