Build an Arithmetic Formatter Project - Build an Arithmetic Formatter Project

Tell us what’s happening:

I dont know what i missing in the code all the rules were done, if any body know please help me

Your code so far

def arithmetic_arranger(problems, show_answers=False):
		output = {'line_1':'', 'line_2':'', 'line_3': '', 'line_4': ''}
		#Make an error for problom if it is more than 5
		if len(problems) > 5 :
				return print('Error: Too many problems.')

		for problem in problems:
				problem_list = problem.split(" ")

				# Make an error for numbers if it is not digit
				if problem_list[0].isnumeric() == False or problem_list[2].isnumeric() == False:
						return print('Error: Numbers must only contain digits.')

				first_num = problem_list[0]
				operator = problem_list[1]
				second_num = problem_list[2]
				if operator == "+":
						answer = int(first_num) + int(second_num)
				elif operator == "-":
						answer = int(first_num) - int(second_num)

				# Make an error for Operator if it is not + or - 
				else:
						return print("Error: Operator must be '+' or '-'.")

				# Make an error for Numbers if it is more than 4 digits
				if len(first_num) > 4 or len(second_num) > 4:
						return print('Error: Numbers cannot be more than four digits.')

				if int(first_num) > int(second_num):
						line_1 = first_num.rjust(len(first_num)+2) + ' ' * 4 
						line_2 = operator + " " + second_num.rjust(len(first_num)) + ' ' * 4 
						line_3 = "-" * (len(first_num) + 2) + ' ' * 4 
						line_4 = str(answer).rjust(len(first_num)+2)+ ' ' * 4   
				else:
						line_1 = first_num.rjust(len(second_num)+2) + ' ' * 4 
						line_2 = operator + " " + second_num.rjust(len(second_num)) + ' ' * 4 
						line_3 = "-" * (len(second_num) + 2) + ' ' * 4 
						line_4 = str(answer).rjust(len(second_num)+2)+ ' ' * 4   

				output['line_1'] += line_1 
				output['line_2'] += line_2 
				output['line_3'] += line_3 
				output['line_4'] += line_4 
				
		#print(output)
		if show_answers:

		    print(f"{output['line_1']}\n{output['line_2']}\n{output['line_3']}\n{output['line_4']}")  

		else:
				print(f"{output['line_1']}\n{output['line_2']}\n{output['line_3']}") 
		

arithmetic_arranger(["32 - 698", "1 - 3801", "45 + 43", "123 + 49", "988 + 40"], True)

Your code appears to run. If you could provide details about the error you receive when you test your code, we could get a hint about whats wrong with your code. Pay attention to the assertion error message.

try returning your output instead of printing it

on the browser console that what it show

i tried it and the same thing

From your assertion error, your output is not the same as what is expected. The (-) sign represents your output while the (+) sign represents what is expected. You will need to edit your code so that your output matches exactly what is expected.
Read this post for more details on assertion error output.