Arithmetic formatter submitting

Hello i’m trying to submit this code for arithmetic formatter but it says that it doesnt match the answer in the test this is the link of the replit: https://replit.com/@Mhamedx/boilerplate-arithmetic-formatter-4#arithmetic_arranger.py
in the log it appears that i have some spaces at the end although i used the rstrip() function but it doesnt work

rstrip will strip only from the end of string. If string has multiple lines with text, each with spaces at the end, only last line will have them stripped.

they say i only have extra spaces at the end the other spaces doesn"t make a problem

Where does it say that?

in the assertion error

As I’ve written, rstrip will strip only from the end of string. If string has multiple lines with text, each with spaces at the end, only last line will have them stripped.

For example:

lines = '''line 1     
line 2     
line 3     '''
lines.rstrip()  # 'line 1     \nline 2     \nline 3'

Thank you , i just solved the problem it was a mistake in the loop if at the end of the code if you checked , the loop didn’t work so it didn’t eliminate the spaces i had to make a small a change and it worked