Need Arithmetic Formatter guidance

Tell us what’s happening:
Hello! I’m new to python and this is my first technical challenge for me. I’ve gotten a decent start on the code but I’m stuck on where to actually format the problems. I’ve thought about indexing into the string to get the values needed for the formatter but I’m having trouble with figuring it out. Also if there’s any other changes that should be done with my code please let me know. Thank you!

Your code so far
import string
def arithmetic_arranger(problems):

for problem in problems:
    fir_int = problem[]
    op = problem[]
    sec_int = problem[]

    # Catches if there are more than 5 problems
    if int(len(problems)) > 5:
        print("Error: Too many problems")
# Catches incorrect operators put in function
    elif '*' in problem:
        print("Error: Operator must be '+' or '-'.")
# Catches if there are characters other than digits in the list
    elif problem in string.ascii_lowercase:
        print("Error: Numbers must only contain digits.")
# Catches the digits only being a max of four digits
    elif len(problem) > 11:
        print("Error: Numbers cannot be more than four digits.")
        # print out the numbers in correct format
        # print(fir_int)
        # print(op + sec_int)

        # work on implementing solution

arithmetic_arranger([“388 + 22”, “4573 - 43”, “1233 + 49”, “1836 + 13”])

Challenge: Arithmetic Formatter

Link to the challenge:

important thing: your function should output the strings with a return statement, including the errors

if you share your repl link I could give it a glance

Link above should take you there. I did it on Pycharm initially. Do you mind clarifying what you mean by returning the strings? and is there any tips you can give to put me on the right track? I’ve tried to come up with solutions in my head but I can’t seem to get a grasp on it. Thank you for your help!

Sorry I’m new on this site so here’s the link

the tests check what is the output of your function - the one determined by the return keyword

right now you have a function defined inside a function, and the code breaks for a syntax error somewhere around ther beginning of the file

an hint:

IN        TEXT IN

to get the above your string needs to be


Oh thank you for clarifying the return statements but I’m not quite sure what you meant with the hint you gave me. can you clarify one more time? Sorry to be a bother but I really want to understand.

what do you not understand of the hint?

Are you saying for it to be formatted like that I need other variables and/or I need to use \n in the concatenation of the strings for it to be formatted correctly?

it was an hint on how the string you build for the output should be

how many variables you need depends on the logic flow you use to build the output

my hint was just that if you want a multi-line need you need to use the new line character \n

Ah okay! thank you for your help I really appreciate it.