8/17/2023 0 Comments Program budgetYou should only be using incomedict and expensedict instead of maintaining four names and expense/income lists. If you're on Python 3.6+ then look into f-strings as well. A more flexible data design might look like this: Entry =. You can cut about half your code by more fully leveraging this.Ĭurrently, each of the two have a list of values, a list of labels, a sum variable, a prompt function, a "check", and a sum function. Income and expenses are the same thing, just with different signs. the class and its methods would benefit from having detailed documentation stringsĪs a side note, take a look at the The Architecture of Open Source Applications project - it is really pure informational gold in terms of designing, thinking and development of your software project.The class itself feels overloaded - this may be because it does two different not-directly related things at the same time - prompting the user and making budget calculations - since you are going to continue to develop the class - make sure Application is not becoming a God Object The following code block can be removed (unless you have it there as a stub for future development): else: variable naming - there are some poor variable names like x or k - consider renaming them to something more descriptive.keep two blank lines between the imports and the class definition, after the class code and the if _name_ = '_main_' line.() after the class Application can be omitted.import os is not used, you can remove it. Here are the few things I've noticed after a first glance on the program: Print('You are in the positive, you have a surplus of ' + '$' + str(valoutput))Īnother = input('Would you like to run another analysis? : ') Print('Total user expenses: ', '$' + str(self.expenses)) : '))Įxpense_name = input('Enter expense name. Print('Total user income: ', '$' + str(self.income))Įxpense_input = int(input('Enter expense amount. Income_input = int(input('Enter source of income. Print('Please enter atleast one source of income. import osĪdd_income = input('Add income? : ')Īdd_expense = input('Add expense? : ') I will add more functionality to this program as I move along in the development process. In its current form this program takes given expenses and income and tells the user whether they have a surplus, a deficit, or if they are breaking even. I've decided to start working on a budget application for the purposes of enhancing my Python skills.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |