 I am clueless on how to do this

Tell us what’s happening:
Describe your issue in detail here.

# This entrypoint file to be used in development. Start by reading README.md
from pytest import main

from arithmetic_arranger import arithmetic_arranger

print(arithmetic_arranger(["32 + 698", "3801 - 2", "45 + 43", "123 + 49"]))

# Run unit tests automatically
main()

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

Challenge: Arithmetic Formatter

Hello there.

Do you have a question?

If so, please edit your post to include it in the Tell us what’s happening section.

Learning to describe problems is an important part of learning how to code.

Also, the more information you give us, the more likely we are to be able to help.

i told you i do not even know the problem

If you honestly know nothing about anything that is going on with the problem, then you should go back to the first Python lesson and start over, or at least back to where you understand what is going on.

If (as I suspect) you understand some of it, then please let us know what specifically is confusing you. It is unrealistic for you to expect one of us to spend an hour explaining every concept associated with that challenge.

And as stated, learning how to figure out what you don’t know and learning how to convey that - that is a very important skill. Good devs aren’t just good at writing code, they’re also good at talking about code.

There is a Readme.txt file that explains the problem to you.
Read that and then come back if you got any questions.

Tell us what’s happening:
Describe your issue in detail here.

import re

def arithmetic_arranger(problems, solve = False):
if (len(problems) > 5):
return "Error: Too many problems."

first = ""
second = ""
lines = ""
sumx = ""
string = ""
for problem in problem :
if(re.search("[^\s0-9.+-]",problem)):
if(re.search("[/]", problem) or re.search("(*)", problem)):
return "Error: operator must be '+' or '-'."
return"error: Numbers mustonly contain digits."

firstNumber = problem.split(" ")
operator = problem.split(" ")
secondNumber = problem.split(" ")

if(len(firstNumber) >= 5 or len (secondNumber) >= 5 ):
return "Error: Numbers must only contain digits."

sum = ""
if (operator == "+"):
sum = str(int(firstNumber) + int(secondNumber))
elif(operator == "-"):
sum = str(int(firstNumber) - int(secondNumber))

length = max(len(firstNumber), len(secondNumber)) + 2
top = str(firstNumber).rjust(length)
bottom = operator + str(secondNumber).rjust(length = 1)
lines = ""
res = str(sum).rjust(length)
for s in range (length):
line += "-"

if problem != problems[-1]:
first += top + "     "
second += bottom + "     "
lines += line + "     "
sumx += res + "     "
else:
first += top
second += bottom
lines += line
sumx += res

if solve:
string = first + "\n" + second + "\n"+ lines + "\n"+ sumx
else:
string = first + "\n" + second + "\n"+ lines
return string

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

Challenge: Arithmetic Formatter

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

What is going on? At the very least you seem to have mismatched indentation, but the more you can tell us, the more we can tell you.

where did i miss match the in dentation could you tell me ?

This is one place. I didn’t scour your code for every instance.

could you tell me how to make it correct

A else or elif has to be at the same indentation as its if.

sum = ""
if (operator == "+"):
sum = str(int(firstNumber) + int(secondNumber))
elif(operator == "-"):
import re

def arithmetic_arranger(problems, solve = False):
if (len(problems) > 5):
return "Error: Too many problems."

first = ""
second = ""
lines = ""
sumx = ""
string = ""
for problem in problem :
if(re.search("[^\s0-9.+-]",problem)):
if(re.search("[/]", problem) or re.search("(*)", problem)):
return "Error: operator must be '+' or '-'."
return"error: Numbers mustonly contain digits."

firstNumber = problem.split(" ")
operator = problem.split(" ")
secondNumber = problem.split(" ")

if(len(firstNumber) >= 5 or len (secondNumber) >= 5 ):
return "Error: Numbers must only contain digits."

sum = ""
if (operator == "+"):
sum = str(int(firstNumber) + int(secondNumber))
elif(operator == "-"):
sum = str(int(firstNumber) - int(secondNumber))

length = max(len(firstNumber), len(secondNumber)) + 2
top = str(firstNumber).rjust(length)
bottom = operator + str(secondNumber).rjust(length = 1)
lines = ""
res = str(sum).rjust(length)
for s in range (length):
line += "-"

if problem != problems[-1]:
first += top + "     "
second += bottom + "     "
lines += line + "     "
sumx += res + "     "
else:
first += top
second += bottom
lines += line
sumx += res

if solve:
string = first + "\n" + second + "\n"+ lines + "\n"+ sumx
else:
string = first + "\n" + second + "\n"+ lines
return string

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

What errors are you seeing now? What have you tried to fix them?

yes but it keeps saying the same thing so i do not know where is wrong

You have not yet described what’s happening yet, so I can’t know what it’s saying to you.

return"error: Numbers mustonly contain digits."

but i have changed it to must not