      "            curr_node = self.head\n",
      "            while curr_node.next is not None:\n",
      "                curr_node = curr_node.next\n",
      "            curr_node.next = node\n",
      "            \n",
      "    def find(self, data):\n",
      "        if data is None:\n",
      "            return\n",
      "        if self.head is None:\n",
 
</s> remove     "            curr_node = curr_node.next"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "%run linked_list.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# Test insert_to_front\n",
    "# Insert in an empty list\n",
    "linked_list = LinkedList(None)\n",
    "linked_list.insert_to_front(10)\n",
    "linked_list.print_list()\n",
    "# Insert a NULL\n",
    "linked_list.insert_to_front(None)\n",
    "linked_list.print_list()\n",
    "# Insert in a list with one element or more elements\n",
    "linked_list.insert_to_front('a')\n",
    "linked_list.insert_to_front('bc')\n",
    "linked_list.print_list()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# Test append\n",
    "# Insert in an empty list\n",
    "linked_list = LinkedList(None)\n",
    "linked_list.append(10)\n",
    "linked_list.print_list()\n",
    "# Insert a NULL\n",
    "linked_list.append(None)\n",
    "linked_list.print_list()\n",
    "# Insert in a list with one element or more elements\n",
    "linked_list.append('a')\n",
    "linked_list.append('bc')\n",
    "linked_list.print_list()"
 </s> add     "            curr_node = curr_node.next\n",
    "\n",
    "    def get_all_data(self):\n",
    "        data = []\n",
    "        curr_node = self.head\n",
    "        while curr_node is not None:\n",
    "            data.append(curr_node.data)\n",
    "            curr_node = curr_node.next\n",
    "        return data" </s> remove     "# Test empty print\n",
    "linked_list = LinkedList(None)\n",
    "linked_list.print_list()"
 </s> add     "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_insert_to_front(self):\n",
    "        print('Test: insert_to_front on an empty list')\n",
    "        linked_list = LinkedList(None)\n",
    "        linked_list.insert_to_front(10)\n",
    "        assert_equal(linked_list.get_all_data(), [10])\n",
    "\n",
    "        print('Test: insert_to_front on a NULL')\n",
    "        linked_list.insert_to_front(None)\n",
    "        assert_equal(linked_list.get_all_data(), [10])\n",
    "\n",
    "        print('Test: insert_to_front general case')\n",
    "        linked_list.insert_to_front('a')\n",
    "        linked_list.insert_to_front('bc')\n",
    "        assert_equal(linked_list.get_all_data(), ['bc', 'a', 10])\n",
    "        \n",
    "        print('Success: test_insert_to_front\\n')\n",
    "        \n",
    "    def test_append(self):\n",
    "        print('Test: append on an empty list')\n",
    "        linked_list = LinkedList(None)\n",
    "        linked_list.append(10)\n",
    "        assert_equal(linked_list.get_all_data(), [10])\n",
    "\n",
    "        print('Test: append a NULL')\n",
    "        linked_list.append(None)\n",
    "        assert_equal(linked_list.get_all_data(), [10])\n",
    "\n",
    "        print('Test: append general case')\n",
    "        linked_list.append('a')\n",
    "        linked_list.append('bc')\n",
    "        assert_equal(linked_list.get_all_data(), [10, 'a', 'bc'])\n",
    "        \n",
    "        print('Success: test_append\\n')\n",
    "        \n",
    "    def test_find(self):\n",
    "        print('Test: find on an empty list')\n",
    "        linked_list = LinkedList(None)\n",
    "        node = linked_list.find('a')\n",
    "        assert_equal(node, None)\n",
    "\n",
    "        print('Test: find a NULL')\n",
    "        head = Node(10)\n",
    "        linked_list = LinkedList(head)\n",
    "        node = linked_list.find(None)\n",
    "        assert_equal(node, None)\n",
    "\n",
    "        print('Test: find general case with matches')\n",
    "        head = Node(10)\n",
    "        linked_list = LinkedList(head)\n",
    "        linked_list.insert_to_front('a')\n",
    "        linked_list.insert_to_front('bc')\n",
    "        node = linked_list.find('a')\n",
    "        assert_equal(str(node), 'a')\n",
    "\n",
    "        print('Test: find general case with no matches')\n",
    "        node = linked_list.find('aaa')\n",
    "        assert_equal(node, None)\n",
    "        \n",
    "        print('Success: test_find\\n')\n",
    "        \n",
    "    def test_delete(self):\n",
    "        print('Test: delete on an empty list')\n",
    "        linked_list = LinkedList(None)\n",
    "        linked_list.delete('a')\n",
    "        assert_equal(linked_list.get_all_data(), [])\n",
    "\n",
    "        print('Test: delete a NULL')\n",
    "        head = Node(10)\n",
    "        linked_list = LinkedList(head)\n",
    "        linked_list.delete(None)\n",
    "        assert_equal(linked_list.get_all_data(), [10])\n",
    "\n",
    "        print('Test: delete general case with matches')\n",
    "        head = Node(10)\n",
    "        linked_list = LinkedList(head)\n",
    "        linked_list.insert_to_front('a')\n",
    "        linked_list.insert_to_front('bc')\n",
    "        linked_list.delete('a')\n",
    "        assert_equal(linked_list.get_all_data(), ['bc', 10])\n",
    "\n",
    "        print('Test: delete general case with no matches')\n",
    "        linked_list.delete('aa')\n",
    "        assert_equal(linked_list.get_all_data(), ['bc', 10])\n",
    "        \n",
    "        print('Success: test_delete\\n')\n",
    "        \n",
    "    def test_len(self):\n",
    "        print('Test: len on an empty list')\n",
    "        linked_list = LinkedList(None)\n",
    "        assert_equal(len(linked_list), 0)\n",
    "\n",
    "        print('Test: len general case')\n",
    "        head = Node(10)\n",
    "        linked_list = LinkedList(head)\n",
    "        linked_list.insert_to_front('a')\n",
    "        linked_list.insert_to_front('bc')\n",
    "        assert_equal(len(linked_list), 3)\n",
    "        \n",
    "        print('Success: test_len\\n')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_insert_to_front()\n",
    "    test.test_append()\n",
    "    test.test_find()\n",
    "    test.test_delete()\n",
    "    test.test_len()"
    "        return node\n",
      "            curr_node = self.head\n",
      "            while curr_node.next is not None:\n",
      "                curr_node = curr_node.next\n",
      "            curr_node.next = node\n",
    "        return node\n",
      "            \n",
      "    def find(self, data):\n",
      "        if data is None:\n",
      "            return\n",
      "        if self.head is None:\n",
keep keep keep add keep keep keep keep keep
 Reworked notebook: Added more detail to constraints and test cases.  Reworked algorithm discussion, code, and unit test. 
linked-lists/linked-list.ipynb