def singleline_diff_format(line1, line2, idx):
    
    """
    Inputs:
        line1 - first single line string
        line2 - second single line string
        idx   - index at which to indicate difference
    Output:
        Returns a three line formatted string showing the location
        of the first difference between line1 and line2.

        If either input line contains a newline or carriage return,
        then returns an empty string.

        If idx is not a valid index, then returns an empty string.
    """
    strng = ""
 
    if "/n" in line1 or "/r" in line1 or "/n" in line2 or "/r" in line2:
        return ""
    elif (idx > len(line1) or idx > len(line2)) or idx < 0:
        return ""
    else:
        for counter in range(idx):
            strng += "="
            counter += 0
   
    strng += "^"
 
    return f"{line1}\n{strng}\n{line2}\n"