Scientific Computing with Python Projects - Arithmetic Formatter

TypeError: arithmetic_arranger() takes 1 positional argument but 2 were given:
it keeps telling me this but i can’t find the problem.

Your code so far

def arithmetic_arranger(problems):
  if len(problems)>5:
    return 'Error: Too many problems.'
  else:
    pass
  # Error: Operator must be '+' or '-'.
  for problem in problems:
    problem=problem.split()
    if problem[1] == "+" or problem[1] == "-":pass
    else: return "Error: Operator must be '+' or '-'."
    # Error: Numbers must only contain digits.
    if problem[0].isnumeric() and problem[2].isnumeric():pass
    else:return "Error: Numbers must only contain digits."
    #"Error: Numbers cannot be more than four digits."
    if len(problem[0]) and len(problem[2]) > 4:
      return "Error: Numbers cannot be more than four digits."
    else:pass

    def arranged_problems(bool=True):
      return arranged_problems

my code

Challenge: Scientific Computing with Python Projects - Arithmetic Formatter

Link to the challenge:

You do not have the argument indicating weather or not to print the answers.

From the challenge description:

“The function should optionally take a second argument. When the second argument is set to True, the answers should be displayed.”

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.