Arithmetic Formatting challenge - solved but still not passing tests

Can someone take a look or try running my solution to the challenge and suggest why it’s not passing the tests?

I’ve ran all the requirements through with CodeRunner and get identical output to the specs but it is still failing in the web app.

def arithmetic_arranger(*arguments):
	#!check for length of problems
	problems = arguments[0][0]
	if len(problems) > 5:
		print('Error: Too many problems.')
		return 'Error: Too many problems.'
	# create a dictionary to store the lines for all the equations
	lines_dict = dict()
	for item in ['line_1','line_2','line_3','line_4']:
		lines_dict[item] = []
		
	for item in problems:
	# split item into equation_split
		equation_split = item.split()	
	# extract operands and operator	
		if len(equation_split[0]) <= 4 and len(equation_split[2]) <= 4:
			if isinstance(int(equation_split[0]),int) and isinstance(int(equation_split[2]),int):
				operand1 = equation_split[0]
				operand2 = equation_split[2]
				#print(operand1,operand2)
			else:
				print('Error: Numbers must only contain digits.')
				return 'Error: Numbers must only contain digits.'
		else:
			print('Error: Numbers cannot be more than four digits.')
			return 'Error: Numbers cannot be more than four digits'

		if equation_split[1] == '+' or equation_split[1] == '-':
			operator = equation_split[1]
		else:
			print('Error: Operator must be '+' or '-'.')
			return 'Error: Operator must be '+' or '-'.'
		
	# calculate length of biggest operand (longest number)
		max_operand_len = max(len(operand1),len(operand2))
		#print("max operand len",max_operand_len)
	# calculate the display length for each equation
		display_len = max_operand_len + 2

		# 1st line
		first_line = ''
		
		## calculate spaces before 1st operand (32)
		spaces = display_len - len(operand1)
		
		## add spaces to first_line
		first_line = spaces * ' '
		
		## add operand to first line
		
		first_line += operand1
		lines_dict['line_1'].append(first_line)
		#print(lines_dict["line_1"])
		
		# 2nd line
		second_line = '{}'.format(operator)
		
		## calculate spaces to line_2
		spaces = (display_len - 1) - len(operand2)
		
		## add spaces to line_2
		second_line += spaces * ' '
		
		## add operand2 to line_2
		second_line += operand2
		lines_dict['line_2'].append(second_line)
		#print(lines_dict["line_2"].
		
		
		# 3rd line
		third_line = '-' * display_len
		lines_dict['line_3'].append(third_line)
		#print(lines_dict["line_3"])
		
		
		# 4th line
		fourth_line = ''
			
		## calculate answer
		answer = None
		if operator == '+':
			answer = str(int(operand1) + int(operand2))
		else:
			answer = str(int(operand1) - int(operand2))
			
		## calculate spaces
		spaces = display_len - len(str(answer))
		
		## add spaces to fourth_line
		fourth_line = spaces * ' '
		
		## add answer to fourth_line
		fourth_line += answer
		lines_dict['line_4'].append(fourth_line)
			
	# join (seperated by 4 spaces) and print the lines in lines_dict
	if not arguments[0].__contains__(True):
		lines_dict.__delitem__('line_4')
	arranged_problems = ""
	for item in lines_dict:
		arranged_problems += '    '.join(lines_dict[item]) + '\n'
	print(arranged_problems)
	#return ("{}\n{}\n{}\n{}".format(first_line,second_line,third_line,fourth_line))
	return arranged_problems

You shouldn’t be both printing and returning.

Does this actually work? I would expect that you need to use outer double quotes.