摘要: 例如: a=[1,2,3] a.append(5) 此时,运行结果为 [1, 2, 3, 5] a=[1,2,3] a.append([5]) 此时,运行结果为 [1, 2, 3, [5]] 结果不再为一个数组,而是list 用append生成多维数组: import numpy as np a=[ 阅读全文
posted @ 2019-10-11 18:18 余生情指教 阅读(25272) 评论(1) 推荐(4) 编辑
摘要: 输入一个包含若干自然数的列表,输出这些数的平均值,结果保留三位小数 1 n=int(input("请输入列表元素个数: ")) 2 list=[] 3 sum=0 4 for i in range(0,n): 5 temp=input("列表数字:") 6 list.append(temp) 7 f 阅读全文
posted @ 2019-10-11 18:10 余生情指教 阅读(30432) 评论(1) 推荐(4) 编辑