Help with the Arithmetic Formatter

I don’t understand how i should return the values. I guess my code checks the conditions just fine.

Here’s the code.

def arithmetic_arranger(problems,bool=False):
    arranged_problems=[]
    l=len(problems)
    if l>5:
        print("Error: Too many problems.")
        quit()
    for i in range(l):
        arranged_problems.append(problems[i].split())
        if len(max(arranged_problems[i]))>4:
            print("Error: Numbers cannot be more than four digits.")
            quit()
        elif arranged_problems[i][1] not in ("+","-"):
            print("Error: Operator must be \'+\' or \'-\'.")
            quit()
        elif arranged_problems[i][0].isdigit()==False or arranged_problems[i][2].isdigit()==False:
            print("Error: Numbers must only contain digits.")
            quit()
    for i in range(l):
            k=arranged_problems[i]
            l=max(len(k[0]),len(k[2]))
            if bool: arranged_problems[i]=k[0].rjust(l+2)+"\n+"+k[2].rjust(l)+("\n"+"-"*(l+2))+"\n"+str(eval(problems[i])).rjust(l+2)
            else: arranged_problems[i]=k[0].rjust(l+1)+"\n+"+k[2].rjust(l)+("\n"+"-"*(l+2))
    return arranged_problems

Challenge: Arithmetic Formatter

Link to the challenge:

what error do you get ? or can you share your repl?