Invalid Syntax Error for Arithmetic Formatter

I’m not able to pass the arithmetic formatter challenge because I keep getting an error code that states “Invalid syntax”

This was my line of codes, apparently the "top = " line is where the error is. length = max(len(firstNumber), len(secondNumber) + 2
top = str(firstNumber).rjust(length)
bottom = operator + str(secondNumber).rjust(length - 1)
line = “”
res = str(sum).rjust(length)
for s in range(length):
line += “-”

I have no idea what could be the solution, please help!

Your browser information:

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

Challenge: Arithmetic Formatter

Link to the challenge:

thanks! However, after I ran the code, I got a bunch of error codes that are hard for me to understand. Could you please tell me where else in my lines of codes that need to be fixed?

those are the results of the tests
they are not easy to understand, but you can manage to with a bit of practice!

let your attention be attracted by the red
the first red line, the one starting AssertionError will explain the test
the second one, starting with assert, will have first your output, then the == operator, then the expected output
what I see is that you return None instead of the expected string

for help with those, please post your code, not a screenshot

will do! thanks for the suggestions!

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