**Tell us what’s happening:**

Hi!

Having some problems with running my code on repl. The traceback is saying that the output string is not in the correct format. I have been unable to pinpoint the cause of this. Everything looks good to me. Please let me know if you can find an issue.

**Your code so far**

```
import re
def arithmetic_arranger(problems, shower=False):
if len(problems) > 5:
return 'Error: Too many problems.'
if any('*' in s for s in problems) or any('/' in s for s in problems):
return 'Error: Operator must be \'+\' or \'-\'.'
for item in problems:
if re.search('[A-Za-z]', item):
return 'Error: Numbers must only contain digits.'
for item in problems:
korv = item.split()
for i in korv:
if len(i) > 4:
return 'Error: Numbers cannot be more than four digits.'
janne = ''
top_row = ''
middle_row = ''
bottom_row = ''
sum_row = ''
for item in problems:
lst = item.split()
mark = '-'
if len(lst[0]) > len(lst[2]):
line = lst[0].rjust(len(lst[0]) + 2) + '\n' + lst[1] + lst[
2].rjust(len(lst[0]) + 1) + '\n' + mark.rjust(
len(lst[0]) + 2, '-')
janne = janne + line
top_row += lst[0].rjust(len(lst[0]) + 2) + ' '
middle_row += lst[1] + lst[2].rjust(len(lst[0]) + 1) + ' '
bottom_row += mark.rjust(len(lst[0]) + 2, '-') + ' '
if lst[1] == '-':
sum_row += str(int(lst[0]) -
int(lst[2])).rjust(len(lst[0]) + 2) + ' '
else:
sum_row += str(int(lst[0]) +
int(lst[2])).rjust(len(lst[0]) + 2) + ' '
elif len(lst[0]) == len(lst[2]):
line = lst[0].rjust(len(lst[0]) + 2) + '\n' + lst[1] + lst[
2].rjust(len(lst[0]) + 1) + '\n' + mark.rjust(
len(lst[0]) + 2, '-')
top_row += lst[0].rjust(len(lst[0]) + 2) + ' '
middle_row += lst[1] + lst[2].rjust(len(lst[0]) + 1) + ' '
bottom_row += mark.rjust(len(lst[0]) + 2, '-') + ' '
janne = janne + line
if lst[1] == '-':
sum_row += str(int(lst[0]) -
int(lst[2])).rjust(len(lst[0]) + 2) + ' '
else:
sum_row += str(int(lst[0]) +
int(lst[2])).rjust(len(lst[0]) + 2) + ' '
else:
line = lst[0].rjust(len(lst[2]) + 2) + '\n' + lst[1] + lst[
2].rjust(len(lst[2]) + 1) + '\n' + mark.rjust(
len(lst[2]) + 2, '-')
janne = janne + line
top_row += lst[0].rjust(len(lst[2]) + 2) + ' '
middle_row += lst[1] + lst[2].rjust(len(lst[2]) + 1) + ' '
bottom_row += mark.rjust(len(lst[2]) + 2, '-') + ' '
if lst[1] == '-':
sum_row += str(int(lst[0]) -
int(lst[2])).rjust(len(lst[2]) + 2) + ' '
else:
sum_row += str(int(lst[0]) +
int(lst[2])).rjust(len(lst[2]) + 2) + ' '
if shower:
return top_row.rstrip() + '\n' + middle_row.rstrip() + '\n' + bottom_row.rstrip() + '\n' + sum_row.rstrip()
else:
return top_row.rstrip() + '\n' + middle_row.rstrip() + '\n' + bottom_row.rstrip()
```

**Your browser information:**

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

.

**Challenge:** Arithmetic Formatter

**Link to the challenge:**