title: Python: Creating a filter function
body: <p>I'm trying to create a function: </p>
  
  <pre><code>filter(delete,lst) 
  </code></pre>
  
  <p>When someone inputs:</p>
  
  <pre><code>filter(1,[1,2,1]) 
  </code></pre>
  
  <p>returns <code>[2]</code></p>
  
  <p>What I have come up with was to use the list.remove function but it only deletes the first instance of delete.</p>
  
  <pre><code>def filter(delete, lst):
  
  """
  
  Removes the value or string of delete from the list lst
  
  """
  
     list(lst)
  
     lst.remove(delete)
  
     print lst
  </code></pre>
  
  <p>My result:</p>
  
  <pre><code>filter(1,[1,2,1])
  </code></pre>
  
  <p>returns <code>[2,1]</code></p>