from __future__ import unicode_literals


class Node(object):

    def __init__(self, val, next=None):
        self.val = val
        self.next = next

    def __repr__(self):
        #  Just display value
        return "{val}".format(val=self.val)


class LinkedList(object):
    """Class for a singly-linked list."""
    def __init__(self, iterable=()):
        self.header = None
        self.length = 0
        for val in reversed(iterable):
            self.insert(val)

    def __repr__(self):
        """Print LinkedList as Tuple literal."""
        node = self.header
        output = ""
        while node is not None:
            output += "{!r}, ".format(node.val)
            node = node.next
        return "({})".format(output.rstrip(' ,'))

    def insert(self, val):
        """Insert val at head of LinkedList."""
        self.header = Node(val, self.header)
        self.length += 1
        return None

    def pop(self):
        """Pop the first val off the head and return it."""
        to_return = self.header  # Use tuple reassignment
        self.header = to_return.next
        # to_return, self.header = self.header, to_return.next
        to_return.next = None
        self.length -= 1
        return to_return

    def size(self):
        """Return current length of LinkedList."""
        return self.length

    def search(self, val):
        """Return the node containing val if present, else None"""
        node, left = self._find(val)
        return node

    def remove(self, val):  # Check Spec: Pass node vs val
        """Remove given node from list, return None"""
        node_to_remove, left_neighbor = self._find(val)

        if self.header == node_to_remove:
            self.pop()

        else:
            left_neighbor.next = node_to_remove.next
            node_to_remove.next = None

        return None

    def display(self):
        """Print LinkedList as Tuple literal"""
        return self.__repr__()

    def _find(self, val):  # Check with spec re: this.
        """Return a Node and left-neighboor by val."""
        val_present = False
        node_inspected = self.header
        left_node = None

        while not val_present:
            #  Interrogate each Node
            if node_inspected.val == val:
                val_present = True
                break
            else:
                #  Keeping track of node to left; incrementing node
                left_node, node_inspected = node_inspected, node_inspected.next

        return node_inspected, left_node

@@ -991,24 +991,103 @@
 turn it.%22%22%22%0A
+        if self.header is None:%0A            raise IndexError%0A        else:%0A    
         to_r
@@ -1132,32 +1132,36 @@
 ignment%0A        
+    
 self.header = to
@@ -1165,32 +1165,36 @@
  to_return.next%0A
+    
         # to_ret
@@ -1240,32 +1240,36 @@
 rn.next%0A        
+    
 to_return.next =
@@ -1274,32 +1274,36 @@
  = None%0A        
+    
 self.length -= 1
@@ -1299,24 +1299,28 @@
 length -= 1%0A
+    
         retu

Add appropriate exception handling to pop()