课程
/后端开发
/Python
/初识Python
L = []
for x=1:
if x<=100:
L.append(x*x)
x=x+1
print sum(L)
2017-02-24
源自:初识Python 7-2
正在回答
L=[] x=1 sum=0 while x<=100 L.append(x*x) x=x+1 sum=sum+x print sum
L =[] x = 1 while x<=100: L.append(x*x) x=x+1 print sum(L)
python 里面for循环只能用来遍历,不能这么写
L = range(1,100) s = 0 for i in L: s = s + i*i print s
Emmanuels
举报
学python入门视频教程,让你快速入门并能编写简单的Python程序