defining a function without using ":"
<p>I have been asked to define a function which is called <code>avg</code>. <code>avg</code> should calculate the average of two lists with the same amount of numbers - take all the numbers from both lists and calculate their average.<br>
However, it is not allowed to use <code>:</code> nor more than one line (except <code>import</code> lines).</p>

<p>My closest try was:</p>

<pre><code>//import line does not count as a line
import numpy
//the code line (only one is allowed)
avg=lambda lst1,lst2: numpy.mean(lst1+lst2)
</code></pre>

<p>My function properly calculates the average of the lists but it contains <code>:</code>, so it is not good enough.    </p>

<p>If someone asked you a pointless question, I would just give him a pointless answer. He deserves it.</p>

<pre><code>import numpy  # You said it doesn't count as a line

# Take the : from dict's docstring.
exec("avg = lambda lst1, lst2{} numpy.mean(lst1+lst2)".format(dict.__doc__[213]))

&gt;&gt;&gt; avg([1,2,3], [1,2,3])
2
</code></pre>

python