declaring the variables def main(): endProgram = "No" while endProgram =="No": expense = 0 total = 0 expense = get_expense(expense) endProgram = raw_input('Did you want to stop? (End program Yes or No)') totalBudgeted = get_budget() calcBudget = calc(total,totalBudgeted,expense) printInfo(calcBudget) #The functions below. This function asks you how much you want to # to budget for the month, for example you want to budget $4,000.00 # The function gets the amount of expenses for the month. def get_expense(expense): expense += input('Enter your expense here:') return expense def get_budget(): amountBudgeted = input('How much do you want to budget?(0 if none)') return amountBudgeted # The function below figures out the # balance. def calc(total,totalBudgeted,expense): calcBudget = total + totalBudgeted - expense return calcBudget # The function below prints the results. def printInfo(calcBudget): print 'The total budget for the month if negative you are under budget: $%.2f' % calcBudget main()
I forgot I'm really new with this python stuff, so could we try to keep it as simple as possible there are so many brillant people here, and most are head and shoulders above me. Thanks again in advance.