Calculate average and remove from list in Scala
<p>I am on my first week with Scala and struggling with the way the code is written in this language.</p>

<p>I am trying to write a function that determines the average number in a list and removes the values below that average. For example:</p>

<p>I have this list:</p>

<pre><code>List[(String, Int)] = List(("A", 1), ("B", 1), ("C", 3), ("D", 2), ("E", 4))
</code></pre>

<p>The result should be <code>2.2</code>.</p>

<p>So the function should also remove the entries <code>("A", 1)</code>, <code>("B", 1)</code> and <code>("D", 2)</code> because they are below the average.</p>

<p>Can anyone help me?</p>