Projects error only appearing in github

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

when i submit my project github give me errors but when i test them my self nothing appears

Your code so far

def main():
    print(arithmetic_arranger(["3 + 855", "988 + 40"],True))

def arithmetic_arranger(problems,value=False):
    numbers=[]
    counter1=0
    longer=0
    top=""
    d=""
    mid=""
    result=""
    numberOfDashes=""
    counter=0
    lengthOfList=len(problems)
    arranged_problems=""
    if lengthOfList>=5:
        return "Error: Too many problems."
        
    else:
        for eq in range(lengthOfList):
            
            if "+" in problems[eq]:
                
                listOfNum=problems[eq].split()
                
                
                for i in listOfNum:
                    
                    
                    if i.isdigit():
                        
                        numbers.append(i)
                
                for j in listOfNum:
                    if not j.isdigit() and (j!="+" and j!="-"):
                        return "Error: Numbers must only contain digits."
                        
                    elif len(j)>4:
                        return "Error: Numbers cannot be more than four digits."
                        
                    elif len(listOfNum[0])> len(listOfNum[2]):
                        longer=len(listOfNum[0])
                    
                    else:
                        longer=len(listOfNum[2])
                
                numberOfDashes=longer+2
                
                
                
                if counter==0:
                    top=top+numbers[0].rjust(numberOfDashes+1)+"    "
                    mid=mid+"+"+numbers[1].rjust(numberOfDashes)+"    "
                    sum1=int(numbers[0])+int(numbers[1])
                    d=d+("-"*(numberOfDashes+1)).rjust(numberOfDashes+1)+"    "
                    result=result+str(sum1).rjust(numberOfDashes+1)+"    "
                else:
                    mid=mid+"+"+numbers[1].rjust(numberOfDashes-1)+"    "
                    top=top+numbers[0].rjust(numberOfDashes)+"    "
                    sum1=int(numbers[0])+int(numbers[1])
                    d=d+("-"*numberOfDashes).rjust(numberOfDashes)+"    "
                    result=result+str(sum1).rjust(numberOfDashes)+"    "
                
                
               
                       
                
                
                counter=1
                numbers=[]
                listOfNum=[]
                
            elif "-" in problems[eq]:
                
            
                
                
                        listOfNum=problems[eq].split()
                
                
                        for i in listOfNum:
                    
                    
                            if i.isdigit():
                        
                                numbers.append(i)
                
                        for j in listOfNum:
                            if not j.isdigit() and (j!="+" and j!="-"):
                                return "Error: Numbers must only contain digits."
                        
                            elif len(j)>4:
                                return "Error: Numbers cannot be more than four digits."

                            elif len(listOfNum[0])> len(listOfNum[2]):
                                longer=len(listOfNum[0])

                            else:
                                longer=len(listOfNum[2])

                            numberOfDashes=longer+2
                        
                
                        if counter1==0:
                            top=top+numbers[0].rjust(numberOfDashes+1)+"    "
                            mid=mid+" -"+numbers[1].rjust(numberOfDashes-1)+"    "
                            sum2=int(numbers[0])-int(numbers[1])
                            d=d+("-"*(numberOfDashes)).rjust(numberOfDashes+1)+"    "
                            result=result+str(sum2).rjust(numberOfDashes+1)+"    "
                        else:
                            top=top+numbers[0].rjust(numberOfDashes)+"    "
                            mid=mid+"-"+numbers[1].rjust(numberOfDashes-1)+"    "
                            sum2=int(numbers[0])-int(numbers[1])
                            d=d+("-"*numberOfDashes).rjust(numberOfDashes)+"    "
                            result=result+str(sum2).rjust(numberOfDashes)+"    "
                            
                        
                      
                
                
                        counter1=1
                        numbers=[]
                        listOfNum=[]
                
                
            else:
                return "Error: Operator must be '+' or '-'."
                
            
    
    if not value:
        arranged_problems=top+"\n"+mid+"\n"+d
    elif value:
        arranged_problems=top+"\n"+mid+"\n"+d+"\n"+result

    
    return arranged_problems








main()

Your browser information:

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

Challenge: Arithmetic Formatter

Link to the challenge:

What errors? How are you testing it yourself?


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 hard, but it 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.

1 Like