Scientific Computing with Python Projects - Arithmetic Formatter

Tell us what’s happening:
Describe your issue in detail here.

Hi all, I just wanted to make sure I’m on the right track, as this error seems to be independent of the program I’m writing and more an issue with the platform it’s on. it was running fine yesterday and then I started getting a weird error after a while. I tried moving to another challenge just to see if maybe I had broken something but even with a clean install of the challenge script it’s giving me the following error:

TypeError: arithmetic_arranger() takes 1 positional argument but 2 were given

it does the same thing in the challenge (with 3 arguments given instead of 2 obviously) when I put the bare minimum code to make it run.

I am still a novice, but this behavior gives me pause and I’m not sure if when I complete the challenge if the tests are bugged or if I should just keep trying to push on. and maybe the tests will work once there’s more working code in my side of the project?

What I’ve done to try to fix
I added to the replit.nix file the test library packages outlined in another post here but that doesn’t seem to be working as a solution.

(screenshot of the time example as it’s more clear what’s going on there)

Your browser information:

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

Challenge: Scientific Computing with Python Projects - Arithmetic Formatter

Link to the challenge:

the error in the arithmetic formatter, it’s only the last two tests or so here so I may just be doing something wrong.

my code:

def arithmetic_arranger(problems):
  error_code = "" #used to determine error type. 0 for all good.
  error_codes = ["", 
                "Error: Too many problems.",
                "Error: Operator must be '+' or '-'.",
                "Error: Numbers must only contain digits.",
                "Error: Numbers cannot be more than four digits."
  returnVal = ""
  #maximum length of problems is 4
  if(len(problems) > 5):
    error_code = error_codes[1]
  #multiplication and division are not allowed.
  if(error_code == 0):
    for i in range(len(problems)):
      if(problems[i].find("*") or problems[i].find("/")):
        error_code = error_codes[2]
  #throw an error if not everything is numeric
  if(error_code == 0):
    for i in range(len(problems)):
      if(not problems[i].replace(" + ", "").replace(" - ", "").isnumeric()): 
        print(problems[i].replace(" + ", "").replace(" - ", ""))
        error_code = error_codes[3]

  #if the first 5 or the last 5 characters are all numeric, 
  #we have too many digets in the set
  if(error_code == 0):
    for i in range(min(4,len(problems))):
      if(problems[i][0:3].isnumeric() and problems[i][-4:].isnumeric()):
        error_code = error_codes[4]

  #if there are no errors up to this point run the program properly
  if(error_code == 0):
    print("Valid Assessment")
    returnVal = error_code
  return returnVal

The code you posted above just returns an empty string when the function is called with valid arguments.

alright. then it’s a problem with my code then. Thank you

yup, I didn’t read the problem description thoroughly enough. Missed that last bit where you need to have an optional parameter of true/false for showing the solutions. My apologies.