首页 > 编程语言 > 详细

python list comprehensions

时间:2020-02-09 13:24:47      阅读:85      评论:0      收藏:0      [点我收藏+]

list comprehensions

You now have all the knowledge necessary to begin writing list comprehensions! Your job in this exercise is to write a list comprehension that produces a list of the squares of the numbers ranging from 0 to 9.

Create list comprehension: squares
squares = [i**2 for i in range(0,10)]

nested list comprehensions

[[output expression] for iterator variable in iterable]

python list comprehensions

原文:https://www.cnblogs.com/gaowenxingxing/p/12286778.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!