      "collapsed": false
     },
     "outputs": [],
     "source": [
      "print('Add values of different lengths')\n",
      "# Input 1: 6->5->None\n",
      "# Input 2: 9->8->7\n",
      "# Result: 5->4->8\n",
      "first_head = Node(6)\n",
      "first_list = MyLinkedList(first_head)\n",
      "first_list.append(5)\n",
      "second_head = Node(9)\n",
      "second_list = MyLinkedList(second_head)\n",
      "second_list.append(8)\n",
      "second_list.append(7)\n",
      "result = MyLinkedList().add(first_list, second_list)\n",
      "result.print_list()\n",
      "print('Add values of same lengths')\n",
      "# Input 1: 6->5->4\n",
      "# Input 2: 9->8->7\n",
      "# Result: 5->4->2->1\n",
      "first_head = Node(6)\n",
      "first_list = MyLinkedList(first_head)\n",
      "first_list.append(5)\n",
      "first_list.append(4)\n",
      "second_head = Node(9)\n",
      "second_list = MyLinkedList(second_head)\n",
      "second_list.append(8)\n",
      "second_list.append(7)\n",
      "result = MyLinkedList().add(first_list, second_list)\n",
      "result.print_list()\n",
      "print('Empty list(s)')\n",
      "result = MyLinkedList().add(None, None)\n",
      "result = MyLinkedList().add(first_head, None)\n",
      "result = MyLinkedList().add(None, second_head)"
     ]
    }
   ],
   "metadata": {
    "kernelspec": {
 
</s> remove    "outputs": [],
 </s> add    "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Test: Empty list(s)\n",
      "Test: Add values of different lengths\n",
      "Test: Add values of same lengths\n",
      "Success: test_add\n"
     ]
    }
   ], </s> remove     "        #import pdb; pdb.set_trace()\n",
 </s> add  </s> remove     "* Test for error cases\n",
    "* Careful with adding if the lists differ\n",
    "    * Only add if a node is not NULL\n",
    "    * Alternatively, we could add trailing zeroes to the smaller list\n",
 </s> add  </s> remove    "execution_count": null,
 </s> add    "execution_count": 3, </s> remove    "execution_count": null,
 </s> add    "execution_count": 2,
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
      "collapsed": false
     },
     "outputs": [],
     "source": [
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_add(self):\n",
    "        print('Test: Empty list(s)')\n",
    "        assert_equal(MyLinkedList().add(None, None), None)\n",
    "        assert_equal(MyLinkedList().add(Node(5), None), None)\n",
    "        assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
    "\n",
    "        print('Test: Add values of different lengths')\n",
    "        # Input 1: 6->5->None\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->8\n",
    "        first_list = MyLinkedList(Node(6))\n",
    "        first_list.append(5)\n",
    "        second_list = MyLinkedList(Node(9))\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 8])\n",
    "\n",
    "        print('Test: Add values of same lengths')\n",
    "        # Input 1: 6->5->4\n",
    "        # Input 2: 9->8->7\n",
    "        # Result: 5->4->2->1\n",
    "        first_head = Node(6)\n",
    "        first_list = MyLinkedList(first_head)\n",
    "        first_list.append(5)\n",
    "        first_list.append(4)\n",
    "        second_head = Node(9)\n",
    "        second_list = MyLinkedList(second_head)\n",
    "        second_list.append(8)\n",
    "        second_list.append(7)\n",
    "        result = MyLinkedList().add(first_list, second_list)\n",
    "        assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
    "        \n",
    "        print('Success: test_add')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_add()"
     ]
    }
   ],
   "metadata": {
    "kernelspec": {
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Reworked notebook: Added more detail to constraints and test cases.  Reworked algorithm discussion and unit test. 
linked-lists/add-reverse.ipynb