jicheng.py 阶乘&& 加强的生成器counter.py
来源:互联网 发布:单片机电压表 编辑:程序博客网 时间:2024/06/06 03:38
jicheng.py
def factorial(n): if n==0 or n==1: return 1 else: return (n*factorial(n-1))
>>> factorial(3)6>>>
counter.py
def counter(start_at=0): count=start_at while True: val=(yield count) if val is not None: count=val else: count+=1
count=counter(5)>>> count.next<method-wrapper 'next' of generator object at 0x0225CFD0>>>> count.next()5>>> count.next()6>>> count.send()Traceback (most recent call last): File "<interactive input>", line 1, in <module>TypeError: send() takes exactly one argument (0 given)>>> count.send(9)9>>> count.next()10>>> count.close()>>> count.next()Traceback (most recent call last): File "<interactive input>", line 1, in <module>StopIteration
- jicheng.py 阶乘&& 加强的生成器counter.py
- py
- py
- py
- py
- py
- py
- py
- Py
- Xctf之调皮的py-py-py
- py 的时间
- python 的sitecustomize.py
- py技术上的优点
- web.py的使用
- web.py的配置
- ptyhon的imageHash.py
- Py的UUID介绍
- py模块的加载
- VB和C语言代码
- 南阳理工学院题目总结1-括号配对问题
- C语言的连接字符串函数
- Form Query String Parameter Tool
- android appwidget
- jicheng.py 阶乘&& 加强的生成器counter.py
- 递归解决八皇后问题
- 全国省市县无刷新多级关联菜单
- 改进后的ipl--读取磁盘,动画显示结果
- uva_11008 - Antimatter Ray Clearcutting ( 状态压缩DP )
- OpenCV2.3.0+VS2010:找不到“opencv_ffmpeg230d.lib ”或者无法打开“CvvImage.h”文件的解决办法
- informatica powercenter 7.x 版本的资源库文件导入到8.6版本的资源库中
- ./configure权限不够
- 利用Phonon框架制作音视频播放器