# Arithmetic arranger problem

Hello i hope you are doing verry well,
i have a problem concerning the arrithmetic arranger problem in scientific computing with python . In fact, i have written my code in my own pyhton IDE on my computer and i have copied all the tests that are given the replit website to see if i have fully done the job. And when i test my code on my own IDE it works very well but when i paste my code in replit and test it on replit i have an issue with 2 tests wich are (test_arrangement, and test_solutions. The problem is that my code works very well on my own IDE .
my code is as follows:

``````#function that detects the first space in a string
def detect_first_space(l):
inter=0
for i in l:
if i==" ":
inter=l.index(i)
return inter;
else:
None;
#function that compares two strings and renturns the index of the longest string in inter in arithmetic_arranger
def compar_str(m):
if len(m)>len(m):
return 0;
else:
return 2;

def arithmetic_arranger(problems,result=False):
if not len(problems)<=5:
return "Error: Too many problems."
inter=[]
r=""
for i in problems:
space_index=detect_first_space(i)
inter.append([i[0:space_index],i[space_index+1],i[space_index+3:]])
for j in inter:
try :
(int(j) and int(j))
except:
return "Error: Numbers must only contain digits."
if not(j=="+" or j=="-" ):
return "Error: Operator must be '+' or '-'."
if not( len(j)<=4 and len(j)<=4):
return "Error: Numbers cannot be more than four digits."
j.append(compar_str(j))
for j in inter:
r+="  "
if j==0 :
r=r+ j
else:
r=r+" "*(len(j)-len(j))
r=r+ j
r+= "    "
r+="\n"
for j in inter :
r=r+j+" "
if j==0 :
r=r+" "*(len(j)-len(j))
r=r+j
else:
r=r+j
r=r+"    "
r=r+"\n"
for j in inter:
r=r+"-"*(2+len(j[j]))
r=r+"    "
if result==True:
r=r+"\n"
for j in inter:
if j=="+":
x=int(j)+int(j)
else:
x=int(j)-int(j)
x=str(x)
if len(x)<(len(j[j])+2):
r=r+" "*(2+len(j[j])-len(x))
r=r+x
else:
r=r+x
r=r+"    "
return r
``````

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0`.

Challenge: Arithmetic Formatter

You can also use the “preformatted text” tool in the editor (`</>`) to add backticks around text.