python函数式编程
来源:互联网 发布:电子教室软件免费版 编辑:程序博客网 时间:2024/05/21 05:57
直接上代码,类似与swift
#! /usr/bin/env python
#def add(x,y,f):# return f(x)+f(y);#print (add(-5,-10,abs));#def format_name(s):# return s[0].upper() + s[1:].lower();#print map(format_name,['adam', 'LISA', 'barT'])#def prod(x, y):# return x*y#print reduce(prod, [2, 3,4, 5],10)#import math#def is_sqr(x):# r = int(math.sqrt(x))# return r*r==x#print filter(is_sqr, range(1, 101))def is_not_empty(s): return s and len(s.strip()) > 0print filter(is_not_empty, ['test', None, '', 'str', ' ', 'END'])
"""def cmp_ignore_case(s1, s2): u1 = s1.upper() u2 = s2.upper() if u1 < u2: return -1 if u1 > u2: return 1 return 0print sorted(['bob', 'about', 'Zoo', 'Credit'], cmp_ignore_case)"""
阅读全文
0 0
- python函数式编程
- Python 函数式编程
- python 函数式编程
- python函数式编程
- Python:函数式编程
- Python函数式编程
- python 函数式编程
- python函数式编程
- python函数式编程
- python-函数式编程
- python 函数式编程
- python函数式编程
- python函数式编程
- Python--函数式编程
- Python: 函数式编程
- Python函数式编程
- python 函数式编程
- Python函数式编程
- 阿里云mysql远程连接不上的问题
- 为什么要使用三次握手
- IEEEremainder
- linux 中线程的查看方式
- Android 极光推送
- python函数式编程
- centos安装youcompleteme
- Samba
- hello!everone
- Redis
- 可重复选择的组合-vijos1060 盒子
- 关于Apache/Tomcat/JBOSS/Neginx/lighttpd/Jetty等一些常见服务器的区别比较和理解
- java方法参数基本类型和方法参数是引用类型的区别
- 工作日常--javascript各种事件总结