def insertion_sort(x):
    """
    Goals: 
    The goal is to sort the an array by starting with the left most element
    and moving left to right move an element back if it is less than the previous
    element until the list is completely ordered.
    
    Variables:
    x is the array inputed into the function.
    Assign counts when ever an index is moved or when two elements are switched.
    Condition counts everytime two elements are compared.
    n is the lengh of the array.
    i is the pointer to which element of the array is being looked at.
    
    Output:
    Array of...
    first is sorted array
    second is amount of conditionals called
    thris is the number of assignments
    """
    Assign = 0
    Condition = 0
    for i in range (1, len(x)): # pass through the array skipping the 0 element
        Assign +=1 # assignment of i
        Condition +=1 # while loop condition
        while x[i] < x[i-1]:
            x[i], x[i-1] = x[i-1], x[i]
            Assign +=2 # the swapping of two elements
            i = i-1
            Assign +=1 # I changing by 1
            Condition +=1 # If condition for i
            if i == 0:
                break
    return x, Assign, Condition