Python Forum
Keep a running total(budget)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Keep a running total(budget)
#1
I am trying to write a budget program. I need to figure out how to keep a running total. How do I update the variable bal via a user input? I have tried while and for loops. This is as close as I can get.  Wall

bal = 0.00

def budget():
    menu = ('1 Set Ballance', '2 Add Transaction', '3 Check Ballance')
    for m in menu:
        print '%s' % m

    what = raw_input('What do you want to do?\n> ').isdigit()

    print bal + what 
    
budget()
Output:
1 Set Ballance 2 Add Transaction 3 Check Ballance What do you want to do? > 1 1.0
Reply


Messages In This Thread
Keep a running total(budget) - by mcmxl22 - Dec-07-2016, 10:09 PM
RE: Keep a running total(budget) - by nilamo - Dec-07-2016, 10:25 PM
RE: Keep a running total(budget) - by mcmxl22 - Dec-07-2016, 10:49 PM
RE: Keep a running total(budget) - by nilamo - Dec-07-2016, 11:04 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Budget optimization in python ronjeremiah 0 1,743 May-16-2021, 01:18 PM
Last Post: ronjeremiah
  Running total counter Crenshaw 2 2,230 Mar-05-2021, 04:19 PM
Last Post: Larz60+
  Please help me to create company budget mad_accountant 2 2,116 Nov-21-2019, 06:01 PM
Last Post: mad_accountant

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020