Scientific Computing with Python Projects - Arithmetic Formatter

Tell us what’s happening:
I have problem with those tests:[test_two_problems_with_solutions] FAILED [ 90%][test_five_problems_with_solutions] FAILED [100%]

_______________ test_template[test_two_problems_with_solutions] _______________

arguments = [[‘3 + 855’, ‘988 + 40’], True]
expected_output = ’ 3 988\n+ 855 + 40\n----- -----\n 858 1028’
fail_message = ‘Expected solutions to be correctly displayed in output when calling “arithmetic_arranger()” with [“3 + 855”, “988 + 40”] and a second argument of True.’

@pytest.mark.parametrize('arguments,expected_output,fail_message', test_cases)
def test_template(arguments, expected_output, fail_message):
  actual = arithmetic_arranger(*arguments)

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

(the second error is same like the first one)

I don’t know how to fix it when I know that once I will get one argument and in the last two I will one more bool argument. (if it was tuple, I could use “try”, but its not :frowning: )

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.134 Safari/537.36

Challenge: Scientific Computing with Python Projects - Arithmetic Formatter

Link to the challenge:

We really need a link to a repl with your code to debug, but this problem looks to be coming from the arithmetic_arranger(*arguments) as the error is telling you the function expects one (positional) argument (the list of problems) but you’re supplying the list items individually (*arguments) and there are two problems, so two arguments.

For the boolean argument, it sounds like you need to research how to add optional arguments to a function (don’t know for sure if that’s the problem since we don’t have your code).

Thats the code:

my code:

(When I tried to test it on my own as a list, it worked and didn’t see any problem)

This code is the problem:

def arithmetic_arranger(problems):
        tasks, solution = problems
        if not(solution is True or solution is False):
            tasks = problems
            solution = False
        tasks = problems
        solution = False

You need to use an optional second argument to control the display of solutions.

Alright, thank you very much :slight_smile: