I’m not sure if you are asking for help with the code or if you are trying to understand something else?
There is no reason for the code to behave differently on replit than anywhere else.
(unless you changed it)
according to the tests, there is multiple issues in the code.
One of the tests for eg. shows this:
> ???
E AssertionError: Expected different output when calling "arithmetic_arranger()" with ["1 + 2", "1 - 9380"]
E assert ' 1 1 \n+ 2 - 9380 \n--- ------ ' == ' 1 1\n+ 2 - 9380\n--- ------'
E - 1 1
E + 1 1
E ? ++++
E - + 2 - 9380
E + + 2 - 9380
E ? ++++
E - --- ------
E + --- ------
E ? ++++
and this means that you have extra spaces at the end of each line (that’s what the ++++ is saying. There is an additional 4 spaces being added to each line being printed).
So try to see why that is.
Another issue:
You are raising Exceptions instead of returning error messages.
The test just wants plain string error messages.