python讀取10個數字,求其平均值

讀取10個數字,求其平均值 代碼以下:web nums=[] #空列表 for i in range(10): #輸入10給數字 nums.append(float(input())) ave=sum(nums)/len(nums) #求平均值 print(ave) ①用for循環輸入10個數字時,用list中的append()方法給列表增添值 ②求和用列表的內建sum()函數
相關文章
相關標籤/搜索