I'm trying to understand some code in python. (I don't know python, only c/c++)
def merge(left, right):
    result = []
    left_idx, right_idx = 0, 0
    while left_idx < len(left) and right_idx < len(right):
        if left[left_idx] <= right[right_idx]:
            result.append(left[left_idx])
            left_idx += 1
        else:
            result.append(right[right_idx])
            right_idx += 1
    if left:   # Confused by this line.
        result.extend(left[left_idx:])
    if right:
        result.extend(right[right_idx:])
    return result
I think I've understood most of the code above except for the if left and if right statements. The way I understand if statements are that they must have an expression following them which evaluates to either a 1 or 0.
 
    