Python

This is what I have learnt about python at Middlesex University.

def ATM():
                                       
    pin = '5555'
    balance = 2000
    overdraft = 200
    while True:
        pin_input = raw_input('insert your PIN number: ')
        if pin == pin_input:
            print 'select from the following options:'
            print
            break
        else:
            print 'wrong pin, try again'
            print
           
    while True:
        menu_input = raw_input('\n1. Balance \n2. Withdraw \n3. Deposit \n4. Exit \nchoose 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('insert the amount you would like to take out: ')
            if (int(Withdraw_input) > balance + overdraft):
                print 'you are beyond your balance limit'
               
            else:
                print '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('enter the  deposit: ')
            print 'The deposited is: ' + str(Deposit_input)
            balance = balance + int(Deposit_input)
           
        elif menu_input == '4':
            print '\n Thank You for using our service'
            break

ATM ()


Do you think is that useful for you? Please leave your comments


11 comments: