Hi everyone one I'm playing around with trying to make an expense calculator.
I would like it so that the user can keep enter expenses until they have no more expenses. Then I would like for the program to give the users total expenses then subtract this from their total income and inform them how much they have left after monthly expenses. Any ideas ? this is what I've come up with thus far.
I would like it so that the user can keep enter expenses until they have no more expenses. Then I would like for the program to give the users total expenses then subtract this from their total income and inform them how much they have left after monthly expenses. Any ideas ? this is what I've come up with thus far.
Code:
# Expense calculator # This program calculates your total monthly expenses #print"\a" print\ """ #-----------------# |Montly Expense | |Calculator 1.0 | #-----------------# Welcome to Monthly Expense Calculator 1.0 this calculator will ask you a series of questions relating to your monthly expenses. It will then calculate your total montly income against your expenses and tell you how much of your take home pay you are spending. """ print " You have the following options:" print "\n To enter an expense type '1' otherwise type '2' for no more expenses." options = ( 'espense = 1', 'noexpense = 2') while True: choice = int(raw_input("\nWould you like to enter a monthly expense?")) if choice == 1: expense = (raw_input("\nEnter expense name")) cost = float(raw_input("\nEnter total monthly cost of this expense.")) elif choice == 2: raw_input("\nPress enter to exit.") break
Comment