廖雪峰的官方网站Python教程练习题
生活随笔
收集整理的這篇文章主要介紹了
廖雪峰的官方网站Python教程练习题
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
利用generator實現楊輝三角
# -*- coding:utf-8 -*- def triangles():L=[1]while(True):yield LL=[1]+[L[x]+L[x+1] for x in range(len(L)-1)]+[1] #測試 n = 0 results = [] for t in triangles():print(t)results.append(t)n = n + 1if n == 10:breakhttps://blog.csdn.net/duhm163/article/details/48161719
https://blog.csdn.net/sunnyluoxiu/article/details/50845481
總結
以上是生活随笔為你收集整理的廖雪峰的官方网站Python教程练习题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Debian Squeez 安装 Gno
- 下一篇: 使用node.js实现图片压缩