python toy codes
来源:互联网 发布:淘宝店是怎么打广告的 编辑:程序博客网 时间:2024/06/05 20:47
函数:
# -*- coding:utf-8 -*-def my_abs(x): if x >= 0: return x else: return -xprint u'请输入数字:'x=raw_input()xx = my_abs(int(x))print u'%s的绝对值是%d' %(x,xx)
列表生成式:
L = ['Hello', 'World', 18, 'Apple', None]print [s.lower() if isinstance(s,str) else s for s in L ]
generator--生成器:
# -*- coding:utf-8 -*-def fib(max): n, a, b = 0, 0, 1 while n < max: print b a, b = b, a + b n = n + 1print fib(7)
0 0
- python toy codes
- codes
- codes
- codes
- [Python]Converting Between Characters and Numeric Codes
- [Python] Use Python to generate Java Unit Test codes automatically
- PyLearn-Codes Python学习代码 下载 廖雪峰Python教程
- python codes模块读写文本文件的简要说明
- New Toy
- POJ2318 TOY
- os toy
- linux toy
- petsc toy
- Toy Army
- hdu2481 Toy
- Complete Guide to Parameter Tuning in XGBoost (with codes in Python)
- Complete Guide to Parameter Tuning in XGBoost (with codes in Python)
- Complete Guide to Parameter Tuning in XGBoost (with codes in Python)
- 【转载】职业规划很全面的一篇文章
- 计算机中的数与数据
- android4.0手机访问某些网页提示证书过期或者证书不符的处理办法
- uva1644
- 判断素数
- python toy codes
- FatMouse' Trade
- freearker相当中的一节指令macro也是自定义函数指令
- SQL Linked Servers创建语句
- CBCentralManager 蓝牙透传
- redis 集群安装配置
- 单件模式基类
- 手机卫士笔记
- 关于Ubuntu装andriod studio(使用genymotion模拟器)