count number of node in linked list
def countNodes ( self ) : NEW_LINE INDENT count = 0 NEW_LINE node = self . head NEW_LINE while node . next is not None : NEW_LINE INDENT count += 1 NEW_LINE node = node . next NEW_LINE DEDENT return count NEW_LINE DEDENT