Skip to content

Eternal Center

  • Single Node (单节点)
    • System (系统)
    • Service (服务)
    • Database (数据库)
    • Container (容器)
    • Virtualization (虚拟化)
  • Multi Node (多节点)
    • Cluster (集群)
    • Big Data (大数据)
    • Cloud Computing (云计算)
    • Batch Processing (批量处理)
  • Other (其它)
    • Ideas (思路)
    • Language (语言)
    • Project (项目)
  • Eternity (永恒)
    • Creations (创作)
    • Classics (经典)
    • Chronicle (编年史)
    • News (消息)
Posted on May 2, 2020July 6, 2022 by Mingyu Zhu

[工具] Python 计算斐波那契数列

  • 介绍
    • 使用方法
  • 脚本

介绍

使用方法

1. 给此脚本添加执行权限
2. 执行此脚本

脚本

#!/usr/bin/python3

print('Fibonacci sequence will be calculated')
num=input('Please make sure to calculate the number of months? ')

fb=[0,1]
month=int(num)

for i in range(1,month-2):
    new=fb[-1]+fb[-2]
    fb.append(new)
print(fb)
CategoriesChinese (中文), Language (语言), Python, Python Science (科学)

Post navigation

Previous PostPrevious [内容] Python 字符串的拼接 (转载)
Next PostNext [工具] Python 统计文件中 IP 地址出现的次数

Aspiration (愿景):

Everyone can achieve self achievement and self happiness fairly

每个人都能公平地实现自我成就和自我幸福

Position (位置):

Running on Evolution Host and DigitalOcean

正在 Evolution Host 和 DigitalOcean 上运行

Logo (徽标):

Additional Information (其他信息):

About Manual Clone Contact
Disclaimer Donation Friendly Links
关于 说明书 克隆 联系
免责申明 捐赠 友情链接

Standby IP Address (备用 IP 地址):

152.69.204.95  150.230.63.10  Please configure before use / 请先配置再使用

Search Outside Website (站外搜索):

Google Wikipedia Bing
Proudly powered by LNMP Proudly powered by WordPress