""" 遍历整个列表 """list_test = [1,2,3,4,5,6] for i in range(len(list_test)): print('列表第'+ str(i)+'个元素为:'+str(list_test[i])) for value in list_test: print('列表元素有'+str(value)) """ 练习题 """list_sum = [] for
"""list_test = [1,2,3,4,5,6]
for i in range(len(list_test)):
print('列表第'+ str(i)+'个元素为:'+str(list_test[i]))
for value in list_test:
print('列表元素有'+str(value))
""" 练习题
"""list_sum = []
for value in range(21):
list_sum.append(value)
print(list_sum)
print(sum(list_sum))