加入收藏 | 设为首页 | 会员中心 | 我要投稿 通化站长网 (https://www.0435zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营中心 > 建站资源 > 优化 > 正文

1 行Python代码能干哪些事,这 13个你知道吗?

发布时间:2019-05-11 20:18:37 所属栏目:优化 来源:编程python新视野
导读:首先你要了解一下Python之禅,一行代码输出The Zen of Python: python -c import this The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than com

8. 一行代码输出斐波那契数列

  1. print([x[0] for x in [(a[i][0], a.append([a[i][1], a[i][0]+a[i][1]])) for a in ([[1, 1]], ) for i in range(30)]]) 

9. 一行代码实现快排算法

  1. qsort = lambda arr: len(arr) > 1 and qsort(list(filter(lambda x: x <= arr[0], arr[1:]))) + arr[0:1] + qsort(list(filter(lambda x: x > arr[0], arr[1:]))) or arr 

(编辑:通化站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!