Build a Budget App Project - Build a Budget App Project

barchart+= line+ " "(5+3len(categoriesL)-len(line))+ “\n”


#the error message
Perc[170 chars] 10| o o o \n 0| o o o \n ----------[254 chars] \n
Perc[170 chars] 10| o o \n 0| o o o \n ----------[204 chars] t 

i dont get where teh o o o is coming from because this is what the displayed output is


#example 
food = Category("Food")
entertainment = Category("Entertainment")
business = Category("Business")    
food.deposit(100)
entertainment.deposit(100)
business.deposit(100)
food.withdraw(5)
entertainment.withdraw(25)
business.withdraw(10)

print(create_spend_chart([food,business,entertainment]))

from the look of it you are rounding wrong the percentage to know how many circles to put in the column. Check again the instructions about the percentage rounding.
The code you are using is not the same that is testing the output.

As @ILM mentioned your calculations are incorrect, and it looks like a rounding error. For reference:

The height of each bar should be rounded down to the nearest 10.

how are you meant to achieve this is it using the math module cuz i tried math ceiling but didnt work

i \tried this

Perc[412 chars]         t  \n              \n              \n              \n
Perc[412 chars] 
        percent= math.floor(spending[index]/totalSpent*10)*10

Ceiling rounds up instead of down.

Perc[362 chars]           m  \n           e  \n           n  \n           t
Perc[362 chars]           m  \n           e  \n           n  \n           t  

why is this an error
AssertionError: ‘Perc[362 chars] m \n e \n n \n t’ != 'Perc[362 chars] m \n e \n n \n t ’
batched @ pyodide.asm.js:9
put_char @ pyodide.asm.js:9
write @ pyodide.asm.js:9
write @ pyodide.asm.js:9
doWritev @ pyodide.asm.js:9
_fd_write @ pyodide.asm.js:9
$write @ pyodide.asm.wasm:0x452eb7
$_Py_write @ pyodide.asm.wasm:0x2d5ea8
$func6422 @ pyodide.asm.wasm:0x3996ee
_PyCFunctionWithKeywords_TrampolineCall @ pyodide.asm.js:9
$func1201 @ pyodide.asm.wasm:0x1a9ff5
$PyObject_VectorcallMethod @ pyodide.asm.wasm:0x1a0a23
$func6492 @ pyodide.asm.wasm:0x39cc2b
$func6490 @ pyodide.asm.wasm:0x39c9e1
$func6488 @ pyodide.asm.wasm:0x39c726
$func6518 @ pyodide.asm.wasm:0x39f365
_PyCFunctionWithKeywords_TrampolineCall @ pyodide.asm.js:9
$func1200 @ pyodide.asm.wasm:0x1a9f1a
$PyObject_VectorcallMethod @ pyodide.asm.wasm:0x1a0a23
$func6559 @ pyodide.asm.wasm:0x3a3955
_PyCFunctionWithKeywords_TrampolineCall @ pyodide.asm.js:9
$_PyEval_EvalFrameDefault @ pyodide.asm.wasm:0x2658c8
$func3175 @ pyodide.asm.wasm:0x26a9f5
$_PyFunction_Vectorcall @ pyodide.asm.wasm:0x1a0038
$_PyObject_FastCallDictTstate @ pyodide.asm.wasm:0x19f7c7
$_PyObject_Call_Prepend @ pyodide.asm.wasm:0x1a023f
$func2495 @ pyodide.asm.wasm:0x1fdeae
$func2393 @ pyodide.asm.wasm:0x1f5cad
_PyCFunctionWithKeywords_TrampolineCall @ pyodide.asm.js:9
$_PyObject_MakeTpCall @ pyodide.asm.wasm:0x19f6c6
$PyObject_Vectorcall @ pyodide.asm.wasm:0x19fcb6
$_PyEval_EvalFrameDefault @ pyodide.asm.wasm:0x266835
$PyEval_EvalCode @ pyodide.asm.wasm:0x25ccf1
$func3115 @ pyodide.asm.wasm:0x259f67
$_PyEval_EvalFrameDefault @ pyodide.asm.wasm:0x26565e
$func3175 @ pyodide.asm.wasm:0x26a9f5
$_PyFunction_Vectorcall @ pyodide.asm.wasm:0x1a0038
$PyObject_Vectorcall @ pyodide.asm.wasm:0x19fcc8
$_pyproxy_apply @ pyodide.asm.wasm:0x159532
Module.callPyObjectKwargs @ pyodide.asm.js:9
Module.callPyObject @ pyodide.asm.js:9
apply @ pyodide.asm.js:9
apply @ pyodide.asm.js:9
runPython @ pyodide.asm.js:9
runPython @ python-test-evaluator.ts:121
test @ VM433:37
ctx.onmessage @ python-test-evaluator.ts:172

AssertionError: 'Perc[362 chars]           m  \n           e  \n           n  \n           t' != 'Perc[362 chars]           m  \n           e  \n           n  \n           t  '
batched @ pyodide.asm.js:9
put_char @ pyodide.asm.js:9
write @ pyodide.asm.js:9
write @ pyodide.asm.js:9
doWritev @ pyodide.asm.js:9
_fd_write @ pyodide.asm.js:9
$write @ pyodide.asm.wasm:0x452eb7
$_Py_write @ pyodide.asm.wasm:0x2d5ea8
$func6422 @ pyodide.asm.wasm:0x3996ee
_PyCFunctionWithKeywords_TrampolineCall @ pyodide.asm.js:9
$func1201 @ pyodide.asm.wasm:0x1a9ff5
$PyObject_VectorcallMethod @ pyodide.asm.wasm:0x1a0a23
$func6492 @ pyodide.asm.wasm:0x39cc2b
$func6490 @ pyodide.asm.wasm:0x39c9e1
$func6488 @ pyodide.asm.wasm:0x39c726
$func6518 @ pyodide.asm.wasm:0x39f365
_PyCFunctionWithKeywords_TrampolineCall @ pyodide.asm.js:9
$func1200 @ pyodide.asm.wasm:0x1a9f1a
$PyObject_VectorcallMethod @ pyodide.asm.wasm:0x1a0a23
$func6559 @ pyodide.asm.wasm:0x3a3955
_PyCFunctionWithKeywords_TrampolineCall @ pyodide.asm.js:9
$_PyEval_EvalFrameDefault @ pyodide.asm.wasm:0x2658c8
$func3175 @ pyodide.asm.wasm:0x26a9f5
$_PyFunction_Vectorcall @ pyodide.asm.wasm:0x1a0038
$_PyObject_FastCallDictTstate @ pyodide.asm.wasm:0x19f7c7
$_PyObject_Call_Prepend @ pyodide.asm.wasm:0x1a023f
$func2495 @ pyodide.asm.wasm:0x1fdeae
$func2393 @ pyodide.asm.wasm:0x1f5cad
_PyCFunctionWithKeywords_TrampolineCall @ pyodide.asm.js:9
$_PyObject_MakeTpCall @ pyodide.asm.wasm:0x19f6c6
$PyObject_Vectorcall @ pyodide.asm.wasm:0x19fcb6
$_PyEval_EvalFrameDefault @ pyodide.asm.wasm:0x266835
$PyEval_EvalCode @ pyodide.asm.wasm:0x25ccf1
$func3115 @ pyodide.asm.wasm:0x259f67
$_PyEval_EvalFrameDefault @ pyodide.asm.wasm:0x26565e
$func3175 @ pyodide.asm.wasm:0x26a9f5
$_PyFunction_Vectorcall @ pyodide.asm.wasm:0x1a0038
$PyObject_Vectorcall @ pyodide.asm.wasm:0x19fcc8
$_pyproxy_apply @ pyodide.asm.wasm:0x159532
Module.callPyObjectKwargs @ pyodide.asm.js:9
Module.callPyObject @ pyodide.asm.js:9
apply @ pyodide.asm.js:9
apply @ pyodide.asm.js:9
runPython @ pyodide.asm.js:9
runPython @ python-test-evaluator.ts:121
test @ VM433:37
ctx.onmessage @ python-test-evaluator.ts:172

i used floor yet i got this message

AssertionError: 'Perc[362 chars]           m  \n           e  \n           n  \n           t' != 'Perc[362 chars]           m  \n           e  \n           n  \n           t  '

nvm i solved it there was two extra spaes i needed at end

2 Likes

if we line up the two strings you can see where the error is, at the end

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.