How to write a function with a list as parameters
<p>Here is the question, I'm  trying to deï¬ne a function <code>sample_mean</code> that takes in a list of numbers as a parameter and returns the sample mean of the the numbers in that list. Here is what I have so far, but I'm not sure it is totally right. </p>

<pre><code>def sample_mean(list):
    """ (list) -&gt; number
     takes in a list of numbers as a parameter and returns the sample mean of the the numbers in that list
     sample_mean =
     sample_mean =
    """

    mean = 0
    values = [list]
    for list in values:
        print('The sample mean of', values, 'is', mean(list))
</code></pre>

<p>As stated above by @idjaw, don't use <code>list</code> as a parameter instead use <code>listr</code> (for example). Your <code>values = [list]</code> is erroneous (also stated by @idjaw) and should be removed.</p>

<p>Also, according to <a href="https://www.python.org/dev/peps/pep-0257/" rel="nofollow">PEP257</a>, you should not use <code>"(list) -&gt; number"</code> in your docstrings as that should only be used for builtins.</p>

<p>Finally, your loop should look like <code>for l in listr:</code> and then you add values to your mean variable. divide it by the number of values in the list and print the result.</p>

python