码迷,mamicode.com
首页 > 编程语言 > 详细

python

时间:2018-03-25 12:06:21      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:and   eve   pytho   推导   ber   偶数   log   number   ==   

列表推导式:

例:用列表推导式生成100内的大于20的偶数

#Use the list to derive an even number greter than 20 in 100
print([x for x in range(0,100) if x % 2 ==0 and x >20])


python

标签:and   eve   pytho   推导   ber   偶数   log   number   ==   

原文地址:https://www.cnblogs.com/iqingchun/p/8643312.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!