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

    Join Date
    Aug 2005
    Posts
    4
    Rep Power
    0

    Need help with a simple python program


    I'm completely new to python and really need help with this. I have written this basic cash fund program that allows a person to withdraw, deposit, and receive a balance from it. But now I need to now add email capabilities, by setting up a database (or list) of account holders' information such as email and other information. When a query is made by a user, they should enter a username or some other means of identification. When the query is accomplished, an email verification of the details should also be sent to the user. Please help! Here is my code so far:


    Code:
    from normalDate import ND
    today = ND()
    
    class Account:
        def __init__(self, initial):
            self.balance = initial
        def deposit(self, amt):
            self.balance = self.balance + amt
        def withdraw(self, amt):
            self.balance = self.balance - amt
        def getbalance(self):
            return self.balance
        
    
    a = Account( 1000.00 )
    inputing = True
    
    while inputing:
        print "Welcome to the Firm's Petty Cash Fund"
        print 
        print '1) Deposit' 
        print '2) Withdraw'
        print '3) Balance'
        print '4) Done'
        print
        action = int(raw_input('Please choose the number next to action you wish to perform: '))            
        if action == 1:
            print
            d = float(raw_input('Enter the amount the amount you have deposited: '))
            print 'You have deposited:', '$',d, 'on', today.formatUS()
            a.deposit(d)
            print 'Your balance is now:', a.getbalance() 
            fill = input('Press Enter to enter to the main menu: ')
                
        elif action == 2:
            print
            w = float(raw_input('Enter the amount that you have withdrawn: '))
            print 'You have withdrawn:', '$',w, 'on', today.formatUS()
            a.withdraw(w)
            print 'Your balance is now:', '$',a.getbalance()
            fill = input('Press Enter to enter to the main menu: ')
            
        elif action == 3:
            print 
            print 'The current balance for', today.formatUS(), 'is', '$',a.getbalance()
            fill = input('Press Enter to enter to the main menu: ') 
            
        else:
            print 'Thank you!'
            inputing = False
    else:
        print 'done'
  2. #2
  3. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    154
    Read this thread. It involves the sending of emails through SMTP.
    http://forums.devshed.com/t281708/s.html

IMN logo majestic logo threadwatch logo seochat tools logo