擅长:python、mysql、java
<p>下面是一个完成此任务的简单方法</p>
<pre><code># importing mean()
from statistics import mean
def Average(Input):
Output =[] # Initialising a blank Output List
for x in Input:
a = round(mean(x),3) # Rounding the mean value to 3 decimal digits
t= (a,) # Making tuple with Mean
Output.append(t) # Making the list of Mean tuples
return Output
Input_1=[[2,4,6],[4,8,1]]
Input_2=[2,6],[8,6],[1,5],[4,5,1]
print(Average(Input_1))
print(Average(Input_2))
</code></pre>