title: Using recursion to remove a value from a linked list
body: <p>my task is to remove the first occurring value from a linked list. The value is inputted by the user. Then, I also have to return a boolean value indicating whether the item was removed (True) or if the value is not in the linked list, return False. This is what I have so far.</p>
  
  <pre><code>def remove(lst, value):
      lst.head = removeRec(lst.head, value)
  
  def removeRec(node, value):
      if isinstance(node, EmptyNode):
          print("Cannot remove value from an empty list")
      elif node.data == value:
          return node.next
      elif:
          node.next = removeRec(node.next, value)
          return node
      else:
          return False
  </code></pre>
  
  <p>The problem with this is that it doesn't return True if the item was removed. How would I implement that? Also, how would I implement a similar function iteratively. Thanks guys.</p>