      "    def __init__(self, data):\n",
      "        self.data = data\n",
      "        self.next = None\n",
      "\n",
      "class LinkedList(object):\n",
      "    def __init__(self, head):\n",
      "        self.head = head\n",
      "        \n",
      "    def delete_node(self, node):\n",
      "        if self.head is None:\n",
      "            return\n",
      "        if node is None:\n",
      "            return\n",
 
</s> remove     "class Node(object):\n",
    "    def __init__(self, data):\n",
    "        self.next = None\n",
    "        self.data = data\n",
    "\n",
    "class LinkedList(object):\n",
    "    def __init__(self, head):\n",
    "        self.head = head\n",
 </s> add     "class MyLinkedList(LinkedList):\n", </s> remove     "class Node(object):\n",
    "    def __init__(self, data):\n",
    "        self.next = None\n",
    "        self.data = data\n",
    "\n",
    "class LinkedList(object):\n",
    "    def __init__(self, head):\n",
    "        self.head = head\n",
    "        \n",
 </s> add     "class MyLinkedList(LinkedList):\n", </s> remove     "class Node(object):\n",
    "    def __init__(self, data):\n",
    "        self.data = data\n",
    "        self.next = None\n",
    "        \n",
    "class LinkedList(object):\n",
    "    def __init__(self, head):\n",
    "        self.head = head\n",
    "        \n",
    "    def __len__(self):\n",
    "        curr = self.head\n",
    "        counter = 0\n",
    "        while curr is not None:\n",
    "            counter += 1\n",
    "            curr = curr.next\n",
    "        return counter\n",
    "        \n",
 </s> add     "class MyLinkedList(LinkedList):\n", </s> remove     "            node.next = next.next\n",
    "\n",
    "        \n",
    "    def insert_to_front(self, data):\n",
    "        if data is None:\n",
    "            return\n",
    "        node = Node(data)\n",
    "        if self.head is None:\n",
    "            self.head = node\n",
    "        else:\n",
    "            node.next = self.head\n",
    "            self.head = node\n",
    "        return node\n",
    "            \n",
    "    def print_list(self):\n",
    "        curr_node = self.head\n",
    "        while curr_node is not None:\n",
    "            print(curr_node.data)\n",
    "            curr_node = curr_node.next"
 </s> add     "            node.next = next.next" </s> remove     "        return prev.data\n",
    "        \n",
    "    def insert_to_front(self, data):\n",
    "        if data is None:\n",
    "            return\n",
    "        node = Node(data)\n",
    "        if self.head is None:\n",
    "            self.head = node\n",
    "        else:\n",
    "            node.next = self.head\n",
    "            self.head = node\n",
    "            \n",
 </s> add     "        return prev.data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "class MyLinkedList(LinkedList):\n",
      "    def __init__(self, data):\n",
      "        self.data = data\n",
      "        self.next = None\n",
      "\n",
    "class MyLinkedList(LinkedList):\n",
    "class MyLinkedList(LinkedList):\n",
    "class MyLinkedList(LinkedList):\n",
    "class MyLinkedList(LinkedList):\n",
      "    def delete_node(self, node):\n",
      "        if self.head is None:\n",
      "            return\n",
      "        if node is None:\n",
      "            return\n",
keep keep keep keep replace replace replace replace keep keep keep keep keep
 Refactored linked list class.  Class is now loaded by other notebooks that reference it. 
linked-lists/delete-mid.ipynb