Can you run this for a sec?

This is my budget app project:
I run it on command prompt and it gives me the correct output:

But I need validation from Replit’s testing program.

Replit does THIS (I add it to the text editor to get the output):

food.deposit(900, “deposit”)
entertainment.deposit(900, “deposit”)
business.deposit(900, “deposit”)
print(create_spend_chart([business, food, entertainment]))

And it returns a failure as if a lot of 'o’s were missing from the output.

Could you please copy my code from Replit and paste it in your text editor, then add THOSE lines (food=Category(“Food”),etc.) and try to run it?

And do you get the same output as I do from command prompt?

(Sorry if my code is unnecessarily long, I’m just glad it works :confused: )

Your browser information:

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

Challenge: Budget App

Link to the challenge:

It’s hard for me to tell…are you creating a bunch of global variables accidentally?

Not really, I just didn’t know how to do it without them.

Ah. Using global variables will wreck havoc with the tests. You end up creating one time use code instead of objects that you can use over and over again. In this case, your code is writing into the same global variables for every single test, so you’re getting a confusing mix of all the test inputs.

In general, global variables are to be avoided.

1 Like

Yeah, I figured that maybe the test program was getting confused somewhere, even though the expected output is exactly the same I get on command prompt. Thank you :raised_hands: :raised_hands:

Hey, thank you so much for the feedback! Just wanted to say that I reduced the code by 100 lines removing most of those variables.

It still resulted in a failure but it’s much more readable now :face_in_clouds: