练习3
来源:互联网 发布:重庆网络电视台 编辑:程序博客网 时间:2024/05/29 13:47
#参数匹配,通过可变参数的匹配形式去收集#传入的参数,参数作为一个元组传入#返回交集def intersect(*args): res=[] for x in args[0]: for other in args[1:]: if x not in other: break else: res.append(x) return res#返回并集def union(*args): res=[] for seq in args: for x in seq: if not x in res: res.append(x) return resprint(intersect("alam","sjkm","hksk" ))print(union([1,2,3],(23,10)))
0 0
- 练习3
- 练习3
- 练习3
- 练习3
- 练习3
- 练习3
- 练习3
- 练习3
- 练习3
- 练习3
- 练习3
- 练习3
- 练习3
- 【SICP练习】3 练习1.7
- 练习3-3
- 练习3-2
- c练习3
- 2010-3-17 练习
- 基于DragonBoard 410c的家庭智能环保卫士——(9)数据库设计
- hdu 1198 Farm Irrigation
- (15):使可变性最小化
- 读《统计自然语言处理》——马尔可夫模型
- Linux 在命令行中创建和展示幻灯片的教程
- 练习3
- LeetCode#371. Sum of Two Integers(位运算)
- Java中Executor、ExecutorService、ThreadPoolExecutor介绍
- rails 不刷新上传文件jquery-fileupload-rails包的简易使用
- 玩转Excel系列-SUMIFS函数使用及实例
- 委托多播
- 第四天2017/03/31(下午2:结构体、数组)
- 类型转换
- 由FlexBox算法强力驱动的Weex布局引擎