```
def AddAndSub(Array, temp):
first_digits = list()
operators = list()
Second_digit = list()
Answer = list()
final_without_answers = list()
final_with_answers = list()
arranged_problems = ""
if len(Array) >= 5:
return "Error: Too many problems."
for items in Array:
if "+" in items:
continue
elif "-" in items:
continue
else:
print("Error: Operator must be '+' or '-'.")
return "Error: Operator must be '+' or '-'."
for items in Array:
if "+" in items:
digits = items.split("+")
if len(digits[0]) >= 5:
print("Error: Numbers cannot be more than four digits.")
return "Error: Numbers cannot be more than four digits."
else:
operators.append("+")
first_digits.append(int(digits[0]))
Second_digit.append(int(digits[1]))
if len(digits[1]) >= 5:
print("Error: Numbers cannot be more than four digits.")
return "Error: Numbers cannot be more than four digits."
if "-" in items:
digits = items.split("-")
if len(digits[0]) >= 5:
print("Error: Numbers cannot be more than four digits.")
return "Error: Numbers cannot be more than four digits."
else:
operators.append("-")
first_digits.append(int(digits[0]))
Second_digit.append(int(digits[1]))
if len(digits[1]) >= 5:
print("Error: Numbers cannot be more than four digits.")
return
if temp:
count= 0
while count < len(first_digits):
if operators[count] == "+":
Answer.append(first_digits[count] + Second_digit[count])
else:
Answer.append(first_digits[count] - Second_digit[count])
count = count+1
iterate = 0
while iterate < len(first_digits):
if temp:
arranged_problems = " "+str(first_digits[iterate])+"\n"+str(operators[iterate])+" "+str(Second_digit[iterate])+"\n-----\n "+str(Answer[iterate])
final_with_answers.append(arranged_problems)
else:
arranged_problems = " "+str(first_digits[iterate])+"\n"+str(operators[iterate])+" "+str(Second_digit[iterate])+"\n-----\n"+str(Answer[iterate])
final_without_answers.append(arranged_problems)
iterate = iterate+1
if temp:
if len(final_with_answers) == 1:
arranged_problems = "%s" %(final_with_answers[0])
elif len(final_with_answers) == 2:
arranged_problems = "%s %s" % (final_with_answers[0], final_with_answers[1])
elif len(final_with_answers) == 3:
arranged_problems = "%s %s %s" % (final_with_answers[0], final_with_answers[1], final_with_answers[2])
elif len(final_with_answers) == 4:
arranged_problems = "%4s %4s %4s %4s" % (final_with_answers[0], final_with_answers[1], final_with_answers[2], final_with_answers[3])
elif len(final_with_answers) == 5:
arranged_problems = "%s %s %s %s %s" % (final_with_answers[0], final_with_answers[1], final_with_answers[2],final_with_answers[3], final_with_answers[4])
return arranged_problems
```

The format I am getting is not meeting the requirements at all, can someone please help with formatting