# Scientific Computing with Python Projects - Arithmetic Formatter

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

``````def arithmetic_arranger(problems, solve = False):
first= ""
second =""
lines = ""
sumx = ""
string= ""
if (len(problems) > 5):
return print("Error: Too many problems.")
for problem in problems:
operator = problem.split()
op1 = problem.split()
op2 = problem.split()

if len(op1) > 4 or len(op2) > 4:
return print("Error: Numbers cannot be more than four digits.")
try:
op1 = int(op1)
op2 = int(op2)
except:
return print("Error: Numbers must only contain digits.")
if operator == "+":
sum = str(op1 + op2)
elif operator == "-":
sum = str(op1 - op2)
else:
return print("Error: Operator must be '+' or '-'")

length=max(len(str(op1)),len(str(op2)))+2
top= str(op1).rjust(length)
bottom = operator+str(op2).rjust(length-1)
line = ""
res = sum.rjust(length)
for l in range(length):
line += "-"
if problem != problems[-1]:
first +=  top + '    '
second += bottom + '    '
lines += line + '    '
sumx += res + '    '
else:
first += top
second += bottom
lines += line
sumx += res

if solve:
string = first +  "\n" + second + "\n" + lines + "\n" + sumx
else:
string = first +  "\n" + second + "\n" + lines
return print (string)
``````

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

Challenge: Scientific Computing with Python Projects - Arithmetic Formatter

Link to the challenge:

Hello there.

Do you have a question?

If so, please edit your post to include it in the Tell us what’s happening section.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more information you give us, the more likely we are to be able to help.