Budget App Project - space problem with create_spend_chart function

hi! my create_spend_chart() function is failing the test because of the spaces, but I don’t seem to find the problem. I’d be grateful if you could help me find it, here’s the code:

def create_spend_chart(categories):
    output = ['Percentage spent by category']
    percentage = []
    category = []
    numbers = list(range(100,-1,-10))

    for budget in categories:
        total = sum([x['amount'] for x in budget.ledger if x['amount']>0])
        spent = sum([x['amount'] for x in budget.ledger if x['amount']<0])
        percentage.append(round((spent*-1)/total * 100))
        category.append(budget.name)
    
    for i in range(len(numbers)):
        output.append("{:3d}|".format(numbers[i]))
        for x in percentage:
            if x >= numbers[i]-5:
                check = 'o'
            else:
                check = ''
            output[i+1] += "{:^3}".format(check)

    output.append('    '+('-'*(3*len(category)+1)))
    longest = max(category,key=len)

    for i in range(len(longest)):
        output.append('    ')
        for j in range(len(category)):
            if len(category[j])> i:
                output[-1] += ' '+category[j][i]+' '
            else:
                output[-1] += '   '

    result = '\n'.join(output)
    return result

it also says the diff is 1232 characters long.

Please provide a link to your project so we can actually see the error message.