PythonPython实现斐波那契数列
Posted haizhibin1989
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PythonPython实现斐波那契数列相关的知识,希望对你有一定的参考价值。
本节主要实现以下目标:
1、递归方法输出斐波那契数列第n个元素的值
2、用迭代器和生成器获取前n个斐波那契数列列表
3、将两种方法写在同一类中
1、递归方法输出斐波那契数列第n个元素的值
![技术分享图片](https://upload-images.jianshu.io/upload_images/3350127-4084f9dd2be8fb88.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/700)
2、用迭代器和生成器获取前n个斐波那契数列列表
![技术分享图片](https://upload-images.jianshu.io/upload_images/3350127-b16eece6da50bdf3.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/700)
3、将两种方法写在同一类中
![技术分享图片](https://upload-images.jianshu.io/upload_images/3350127-4a8c7786c9e18149.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/700)
以上是关于PythonPython实现斐波那契数列的主要内容,如果未能解决你的问题,请参考以下文章