Scientific Computing with Python Projects - Arithmetic Formatter

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

Your code so far

Your browser information:

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

Challenge: Scientific Computing with Python Projects - Arithmetic Formatter

Link to the challenge:

hi there, welcome to the forum. What question did you want to ask?

i am having a challenge of getting the test incorrect operator from the unicast pytest, what should i do?

I am sorry, I didn’t understand. Can you rephrase or show me a screenshot of the error you are having?

please i am not able to check for test_incorrect_operator, what am i not getting right?

Please post the url of the replit you are using for this.

boilerplate-arithmetic-formatter (12) - Replit

The problem is the following logic:

            if re.search("[/] [*]", problem):
                return ("Error: Operators must be '+' or '-'.")

First, you have a typo in the return statement.

Second, "[/] [*]" is not doing what you think it is doing. You need to make a slight modification to your regular expression. The above expression searches for the case where / is immediately followed by a space character and then immediately followed by *

Something else to consider even though the existing tests to not test for it, would your function return the correct value for the following cases?

arithmetic_arranger(["32 ++ 698", "3801 - 2", "45 + 43", "123 + 49"])

or

arithmetic_arranger(["32 = 698", "3801 - 2", "45 + 43", "123 + 49"])