#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    55
    Rep Power
    2

    Question about making colums line up


    Im stuck on making these columns line up:

    g_balance = 0
    p

    def setBalance(amount):
    global g_balance
    if amount:
    g_balance = amount


    def printBalance():
    global g_balance
    if g_balance >=0:
    printNow("%s $%0.2f" % ("Currrent balance is",g_balance))


    def deposit (date, details, deposit):
    global g_balance
    g_balance = g_balance + deposit
    printNow("%s %15s \t\t$%10.2f \t$%10.2f" % (date,details,deposit, g_balance))

    def withdraw (date, details, withdraw):
    global g_balance
    g_balance = g_balance - withdraw
    printNow("%s %15s \t\t$%10.2f \t$%10.2f" % (date,details,withdraw, g_balance))


    setBalance(500)
    printBalance()
    withdraw("17-12-2012", "BP - petrol", 72.50)
    withdraw("19-12-2012", "Countdown", 55.50)
    withdraw("20-12-2012", "munchies", 1.99)
    withdraw("22-12-2012", "Vodafone", 20)
    deposit ("23-12-2012", "Income", 225)
    withdraw("24-12-2012", "Presents", 99.02)
    printBalance()


    I think i need to use def printLedgerLine function in order to make them line up but i dont know what is supposed to go inside that function. please help
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,841
    Rep Power
    480
    Dear dear kidoman,
    Have you figured out how to run python on your own computer yet?
    Thanks, Dave
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    55
    Rep Power
    2
    Originally Posted by b49P23TIvg
    Dear dear kidoman,
    Have you figured out how to run python on your own computer yet?
    Thanks, Dave
    Yes i knew how to run python for a while now since our lecturer showed us everything about installing and running JES.
  6. #4
  7. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,841
    Rep Power
    480
    Please next explain the
    printNow function.
    JES is jython environment for students, which I don't have.
    [code]Code tags[/code] are essential for python code and Makefiles!
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    55
    Rep Power
    2
    Originally Posted by b49P23TIvg
    Please next explain the
    printNow function.
    JES is jython environment for students, which I don't have.
    printNow prints the function..u can only use printNow in the Console window(white window)...in the command window(black window) you can just use print

IMN logo majestic logo threadwatch logo seochat tools logo