Empty list returned from saving function
<p>This what I asked to do:</p>

<blockquote>
  <p><code>save_friends(filename, friends_list)</code> takes a file name and a friends list and writes that list to thefile in the correct format. So, for example,
  save_friends('friends.csv', load_friends('friends.csv'))
  should overwrite the friends le with exactly the same content.</p>
</blockquote>

<p>This is my code:</p>

<pre><code>def save_friends(filename, friends_list): 
    """
    take a file name and a friends list and wrients that list
    to the file in the correct format

    save_friend(file, list) -&gt; list
    """
    friends_list = []
    f = open(filename, 'w')
    for friend in friends_list:
        f.write(friend+ '\n')
    return friends_list 
    f.close()
</code></pre>

<p>The problem is when I run the text code(a code provided by school that dose some simple tests), it tells me </p>

<pre><code>&gt;&gt;&gt;save_friends('friends_output.csv', d)
[ ]

Traceback (most recent call last):
  File "E:\study\Yr 1\Semister1\CSSE1001\Assignment\sample_tests.py", line 84, in &lt;module&gt;
    assert res == None, "save_friends didn't return None"
AssertionError: save_friends didn't return None
</code></pre>

<p>So, how can I return 'None' while the input is not really a list(Like the input 'd' in this circumstance)?</p>
