# Build an Arithmetic Formatter Project - Build an Arithmetic Formatter Project

### Tell us what’s happening:

if len(problems) > 5:
return "Error: Too many problems."
char_top = []
char_bottom = []
char_line = []
for problem in problems:
parts = problem.split()
arg1 = parts[0]
operator = parts[1]
arg2 = parts[2]
if operator not in ["+","-"]:
return "Error: Operator must be '+' or '-'."
if len(arg1) > 4 or len(arg2) > 4:
return "Error: Numbers cannot be more than four digits"
try:
result = str(eval(problem))
except:
return "Error: Numbers must only contain digits."
max_length = max(len(arg1), len(arg2)) + 2
char_top.append(arg1.rjust(max_length))
char_bottom.append(operator + " " + arg2.rjust(max_length - 2))
char_line.append('-' * max_length)
arranged_problems = ""
if char_top:
arranged_problems += "    ".join(char_top) + "\n"
if char_bottom:
arranged_problems += "    ".join(char_bottom) + "\n"
if char_line:
arranged_problems += "    ".join(char_line) + "\n"
return arranged_problems

print(f'\n{arithmetic_arranger(["32 + 698", "3801 - 2", "45 + 43", "123 + 49"],True)}')

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36

### Challenge Information:

Build an Arithmetic Formatter Project - Build an Arithmetic Formatter Project

Which tests are failing? What is your output for those testes? What is the output supposed to be for those tests?

1 Like

Check the browser console for a more detailed output from the tests

1 Like

hello ,can someone explain to me this line of code?

eval will evaluate the string passed to it as code, and so it calculate the result