Budget App create_spend_chart not passing

def create_spend_chart(arr):
    name = list(map(lambda x : x.category,arr))
    names = map(lambda x:x.ljust(len(max(name,key=len))+1," "),name)
    percentage =['100|', ' 90|', ' 80|', ' 70|', ' 60|', ' 50|', ' 40|', ' 30|', ' 20|', ' 10|', '  0|']

    withdraw = sum(map(lambda x: reduce(lambda a, b : a+b['amount'], \
      filter(lambda f: f['amount'] < 0,x.ledger[1:]),0),arr))
    
    draw = map(lambda x:int(round(x/10)),map(lambda x:reduce(lambda a, b : a+b['amount'], \
      filter(lambda f: f['amount'] < 0,x.ledger),0)*100/withdraw,arr))
    
    string = list(map(lambda x: (x * 'o').rjust(11," "),draw))
    k = list(zip(*string))
    expect = ["Percentage spent by category"]

    for i in range(11):
      expect.append(percentage[i] +" " + "  ".join(k[i]))
    expect.append(" " * 4 + "----------")

    for k in zip(*names):
      expect.append(" " * 5 + "  ".join(k))
    return '\n'.join(expect[:-1])

What is wrong in here

What error are you getting? Can you link to your repl.it code?

Traceback (most recent call last):
File “/home/runner/boilerplate-budget-app/test_module.py”, line 94, in test_create_spend_chart
self.assertEqual(actual, expected, ‘Expected different chart representation. Check that all spacing is exact.’)
AssertionError: ‘Perc[33 chars] \n 90| \n 80| \n 70| [293 chars] t’ != 'Perc[33 chars] \n 90| \n 80| \n 70| [341 chars] t ’

The error is telling you that the spacing is not right. Here’s a bit of the expected output from the unit tests (reformatted from the original):

            " 20|    o  o  \n"
            " 10|    o  o  \n"
            "  0| o  o  o  \n"

Here’s the corresponding output of the tests on your code on my machine:

-  20|    o   
+  20|    o  o  
?            ++
-  10|    o  o
+  10|    o  o  
?             ++
-   0| o  o  o
+   0| o  o  o  
?             ++

The - lines are your output, the + lines are the expected output, and the ? indicate differences. So, your lines are missing some spaces and your columns are all one o short.

Good luck.

draw = map(lambda x:int(math.ceil(x/10)),map(lambda x:reduce(lambda a, b : a+b[‘amount’],
filter(lambda f: f[‘amount’] < 0,x.ledger),0)*100/withdraw,arr))

expect.append(percentage[i] +" " + " ".join(k[i]) + " ")
expect.append(" " * 4 + "---------- ")