列表生成

#__author__:Administrator}
#data: 2017/11/28

a = [x for x in range(10)]
print(a)
a = [x*2 for x in range(10)]
print(a)
a = [x*x for x in range(10)]
print(a)

def f(n):
return n**3
a = [f(x) for x in range(10)]
print(a)

#知识点
t=(123,'b')
a,b=t#等价于a=t【0】,b=【1】
print(a)
print(b)
posted @ 2017-12-01 17:52  无敌帅帅头  阅读(90)  评论(0编辑  收藏  举报