> **failing two test cases 1.test_arrangement ,2.test_solutions*
> Describe your issue in detail here.
>
> **Your code so far**
```def arithmetic_arranger(problems,*args):
if len(problems)>5:
return "Error: Too many problems."
for s in problems:
x=len(s[:s.index(" ")])
y=len(s[s.index(" ")+3:])
if '/' in s or '*' in s:
return "Error: Operator must be '+' or '-'."
if x>4 or y >4:
return "Error: Numbers cannot be more than four digits."
if not s[:s.index(" ")].isnumeric() or not s[s.index(" ")+3:].isnumeric():
return "Error: Numbers must only contain digits."
for s in problems:
s1=" "
b=s.index(s1)
x=len(s[:b])
y=len(s[b+3:])
k=max(x,y)
if x<y:
for i in range (k+2-min(x,y)):
print(" ",end="")
else:
for i in range (2):
print(" ",end="")
if s is not problems[len(problems)-1]:
print(s[:b],end=" ")
else:
print(s[:b])
# print("\r")
for s in problems:
s1=" "
b=s.index(s1)
x = len(s[:b])
y = len(s[b + 3:])
print(s[b+1],end=" ")
if y<=x:
for i in range(x-y):
print(" ",end="")
if s is not problems[len(problems)-1]:
print(s[b+3:],end=" ")
else:
print(s[b+3:])
else:
if s is not problems[len(problems)-1]:
print(s[b+3:],end=" ")
else:
print(s[b+3:])
#print("\r")
for s in problems:
s1=" "
b=s.index(s1)
x = len(s[:b])
y = len(s[b + 3:])
k=max(x,y)
for i in range(k+2):
print('-',end='')
if s is not problems[len(problems)-1]:
print(end=" ")
if args:
for s in problems:
s1=" "
b=s.index(s1)
x = len(s[:b])
y = len(s[b + 3:])
k=max(x,y)
a=str(eval(s))
for i in range(k+2-len(a)):
print(' ',end='')
if s != problems[len(problems)-1]:
print(a,end=" ")
else:
print(a)
`> Blockquote`
**Your browser information:**
User Agent is: <code>Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0</code>.
**Challenge:** Arithmetic Formatter
**Link to the challenge:**
https://www.freecodecamp.org/learn/scientific-computing-with-python/scientific-computing-with-python-projects/arithmetic-formatter
Hi @rude1609 ,
The arithmetic_arranger function is not returning anything.
This line print(arithmetic_arranger([“32 + 698”, “3801 - 2”, “45 + 43”, “123 + 49”])) in the main module is not getting a return value.
Instead of the print statements in your function, you can try to append a string variable and return that.
1 Like
thank you very much!!!
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.