Python

Welcome to my python page.

The video below has been taken from YouTube which is a basic tutorial of python while loop for programming students in foundation year. i hope you learn something from it and enjoy it!

Time: 14/12/12 -  15:14
http://www.youtube.com/watch?v=HYaY2Oon9Uk




The following program that I have written below is a ATM machine program which has been created by James using the Python programming software. Unfortunately I could not find my own program as I have saved it somewhere that I do not remember anymore.



def Mdx.ATM():
    pin = '7777'
    balance = 500
    overdraft = 100
    while True:
        pin_input = raw_input('Please enter your PIN number: ')
        if pin == pin_input:
            print
            print 'Please select from the following options:'
            print
            break
        else:
            print
            print 'Incorrect pin, Please try again'
            print
           
    while True:
        menu_input = raw_input('\n1. Balance \n2. Withdraw \n3. Deposit \n4. Exit \nSelect from menu: ')
        if menu_input == '1':
            print '\nAvailable withdraw: ' + str(balance + overdraft)
            print '\nYour overdraft limit is: ' + str(overdraft)
           
        elif menu_input == '2':
            Withdraw_input = raw_input('Please enter the amount you would like to take out: ')
            if (int(Withdraw_input) > balance + overdraft):
                print 'You are over your the limit'
               
            else:
                print 'You have withdrawn: ' + str(Withdraw_input)
                if (int(Withdraw_input) > balance):
                    overdraft == overdraft_2
                    overdraft_2 = overdraft - (int(Withdraw_input) - balance)
                balance = (balance + overdraft)- int(Withdraw_input)
                          
  
        elif menu_input == '3':
            Deposit_input = raw_input('Please enter the amount you would like to deposit: ')
            print 'The ammount you have deposited is: ' + str(Deposit_input)
            balance = balance + int(Deposit_input)
           
        elif menu_input == '4':
            print '\n Thank You for using our service, Good Bye!'
            break

4 comments:

  1. This was one of the most difficult modules ever!!!!

    ReplyDelete
  2. i found this quite easy to be honest. it just takes time to understand the basic knowledge

    ReplyDelete