摘要: from random import randint data = [randint(0, 20) for _ in xrange(30)] print data # [20, 4, 4, 20, 15, 9, 3, 13, 9, 8, 6, 16, 18, 7, 8, 12, 14, 5, 7, 7, 7, 5, 12, 4, 15, 3, 18, 1, 10, 9] c = dict.fr... 阅读全文
posted @ 2019-04-07 22:26 AngDH 阅读(415) 评论(0) 推荐(0) 编辑
摘要: from random import randint """ list 过滤掉负数 """ data = [randint(-10, 10) for _ in xrange(10)] print data # [7, 2, -5, -5, 2, -4, -7, 6, -9, 9] d1 = filter(lambda x: x >= 0, data) print d1 # [7, 2, 2, ... 阅读全文
posted @ 2019-04-07 21:35 AngDH 阅读(3505) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2019-04-07 21:26 AngDH 阅读(175) 评论(0) 推荐(0) 编辑