<qiyuangong>086_Partition_List_1.py
def partition( head, x):
    if head is None:
        return None
    less = lesshead = None
    last = pos = head
    while pos is not None:
        if pos.val < x:
            if lesshead is None:
                lesshead = pos
            else:
                less.next = pos
            less = pos
            if head == pos:
                last = head = pos.next
            else:
                last.next = pos.next
        else:
            last = pos
        pos = pos.next
    if lesshead is not None:
        less.next = head
    else:
        lesshead = head
    return lesshead
def sample_funcname ( var_0 , var_1 ) :
    if var_0 is None :
        return None
    var_4 = var_3 = None
    var_6 = var_5 = var_0
    while var_5 is not None :
        if var_5.val < var_1 :
            if var_3 is None :
                var_3 = var_5
            else :
                var_4.next = var_5
            var_4 = var_5
            if var_0 == var_5 :
                var_6 = var_0 = var_5.next
            else :
                var_6.next = var_5.next
        else :
            var_6 = var_5
        var_5 = var_5.next
    if var_3 is not None :
        var_4.next = var_0
    else :
        var_3 = var_0
    return var_3
