# Arithmetic Arranger Format Issue

Tell us what’s happening:
I am having trouble getting the formatting for the problem to work. I can get the answers to print and each individual problem formats, but I am having trouble getting each answer on the same line. Any advice is appreciated, thank you!

``````def arithmetic_arranger(problems, show_answers=True):
arranged_problems = []
if len(problems) > 5:
print("Error: Too many problems.")
for problem in problems:
problem = problem.split(" ")
op1 = problem
operand = problem
op2 = problem
if operand == "+":
elif operand == "-":
if operand not in ['+', '-']:
print("Error: Operator must be '+' or '-'.")
break
elif op1.isdecimal() is False or op2.isdecimal() is False:
print("Error: Numbers must only contain digits.")
break
elif len(op1) > 4 or len(op2) > 4:
print("Error: Numbers cannot be more than four digits.")
break
else:
op1 = op1.rjust(5)
op2 = op2.rjust(4)
output = op1 + '\n' + operand + op2 + '\n' + '-----' + '\n' + str(answer).rjust(5) + '\n'
output = op1 + '\n' + operand + op2 + '\n' + '-----' + '\n'

arranged_problems.append(output)
return arranged_problems

print(arithmetic_arranger(["33 + 55", "2 - 99", "24 + 765", "4 - 8", "9956 + 1"], show_answers=True))
``````

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36`.
{"ft_lang_label":"__label__en","ft_lang_prob":0.5692198,"math_prob":0.9803696,"size":1564,"snap":"2022-05-2022-21","text_gpt3_token_len":460,"char_repetition_ratio":0.13653846,"word_repetition_ratio":0.101265825,"special_character_ratio":0.3612532,"punctuation_ratio":0.17834395,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98856956,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-05-20T11:48:03Z\",\"WARC-Record-ID\":\"<urn:uuid:c98b19b9-5d9e-4fc6-8439-e66d04a2448b>\",\"Content-Length\":\"24044\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:cc0e192e-b2b5-48e5-947c-7e7ff9311233>\",\"WARC-Concurrent-To\":\"<urn:uuid:3bcb39ae-4100-4239-b892-78143537475f>\",\"WARC-IP-Address\":\"64.71.144.205\",\"WARC-Target-URI\":\"https://forum.freecodecamp.org/t/arithmetic-arranger-format-issue/422685\",\"WARC-Payload-Digest\":\"sha1:UKQ2JDZWKBGI6HQLJORG6PKQ7HMSVNSP\",\"WARC-Block-Digest\":\"sha1:ZPGPZNJW6DEDY4LTLQVPRKVUDQ6KBDME\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-21/CC-MAIN-2022-21_segments_1652662531779.10_warc_CC-MAIN-20220520093441-20220520123441-00266.warc.gz\"}"}