擅长:python、mysql、java
<p>我今天找到了答案。
多亏了@adrtam。你知道吗</p>
<p>(我想我应该用英语做编码。因为我试着把它从土耳其语翻译成英语。o d o)</p>
<p>这是我需要的答案</p>
<pre><code>import math
diff_list=list()
for num in numlist:
diff=mean-num
diff=math.fabs(diff)
diff_list.append(diff)
print("str(numlist[diff_list.index(min(diff_list))])"+” is found as the closest number to the mean in the number list and deleted.")
numlist.pop(diff_list.index(min(diff_list)))
</code></pre>
<p>我创建了另一个列表来保存数字列表中数字的绝对平均值。然后找到最接近意思的。取它的索引。然后从数字列表中删除该索引。因为它们没有排序,所以它们的索引应该是相同的。你知道吗</p>