def side_by_side(left, right):
    r"""Put two boxes next to each other.

    Assumes that all lines in the boxes are the same width.

    Example:
        >>> left = 'A \nC '
        >>> right = 'B\nD'
        >>> print(side_by_side(left, right))
        A B
        C D
        <BLANKLINE>
    """
    left_lines = list(left.split('\n'))
    right_lines = list(right.split('\n'))

    # Pad the shorter column with whitespace
    diff = abs(len(left_lines) - len(right_lines))
    if len(left_lines) > len(right_lines):
        fill = ' ' * len(right_lines[0])
        right_lines += [fill] * diff
    elif len(right_lines) > len(left_lines):
        fill = ' ' * len(left_lines[0])
        left_lines += [fill] * diff

    return '\n'.join(a + b for a, b in zip(left_lines, right_lines)) + '\n'
def side_by_side ( left , right ) : left_lines = list ( left . split ( '\n' ) ) right_lines = list ( right . split ( '\n' ) ) diff = abs ( len ( left_lines ) - len ( right_lines ) ) if len ( left_lines ) > len ( right_lines ) : fill = ' ' * len ( right_lines [ 0 ] ) right_lines += [ fill ] * diff elif len ( right_lines ) > len ( left_lines ) : fill = ' ' * len ( left_lines [ 0 ] ) left_lines += [ fill ] * diff return '\n' . join ( a + b for a , b in zip ( left_lines , right_lines ) ) + '\n'
r"""Put two boxes next to each other.

    Assumes that all lines in the boxes are the same width.

    Example:
        >>> left = 'A \nC '
        >>> right = 'B\nD'
        >>> print(side_by_side(left, right))
        A B
        C D
        <BLANKLINE>