      "        value += second_node.data if second_node is not None else 0\n",
      "        remainder = value % 10\n",
      "        new_carry = 1 if value >= 10 else 0\n",
      "        node = Node(remainder)\n",
      "        #import pdb; pdb.set_trace()\n",
      "        node.next = self.__add__(first_node.next if first_node is not None else None, \n",
      "                                 second_node.next if first_node is not None else None, \n",
      "                                 new_carry)\n",
      "        return node\n",
      "\n",
 
</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     "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)"
 </s> 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()" </s> remove     "* Space: O(n), extra space for result and recursion depth"
 </s> add     "* Space: O(n), extra space for result and recursion depth\n",
    "\n",
    "Notes:\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" </s> remove     "    * Return NULL for an invalid operation"
 </s> add     "    * Return NULL for an invalid operation\n",
    "* How large are these numbers--can they fit in memory?\n",
    "    * Yes\n",
    "* Can we assume we already have a linked list class that can be used for this problem?\n",
    "    * Yes" </s> remove     "## Clarifying Questions\n",
 </s> add     "## Constraints and Assumptions\n",
    "\n",
    "*Problem statements are often intentionally ambiguous.  Identifying constraints and stating assumptions can help to ensure you code the intended solution.*\n",
      "        value += second_node.data if second_node is not None else 0\n",
      "        remainder = value % 10\n",
      "        new_carry = 1 if value >= 10 else 0\n",
      "        node = Node(remainder)\n",

      "        node.next = self.__add__(first_node.next if first_node is not None else None, \n",
      "                                 second_node.next if first_node is not None else None, \n",
      "                                 new_carry)\n",
      "        return node\n",
      "\n",
keep keep keep keep 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