def input_location(img_size):
    """
    Prompt the user to input a  y location for text placement. Also deals with error handling.
    """

    while True:
        print(f'\nPlease enter a number between 0 and {img_size}')
        while True:
            try:
                y = int(input('Enter an y coordinate: '))
            except ValueError:
                print('\nThat is not a valid y coordinate!')
            else:
                break

        if 0 < y < img_size:
            break
        else:
            print('\nThat is not a valid y coordinate!')

    return y