About Python

Python

About Python

Python is a remarkably powerful dynamic programming language that is used in a wide variety of application domains

Below will be a coding that I have created as a ATM for students to use at my university. 


def Hole_On_The_Wall():
    Pin = '1212'
    Overdraft = 500
    Balance = 1000
    Output = False
    while Output == False:
        Pin_input = raw_input("Please Enter Your Pin:")
        if Pin_input == Pin:
            print ("\nPIN SUCCESSFUL\n")
            Output = True
        else:
            print "\nINVALID ENTRY, PLEASE TRY AGAIN\n"
   

    Output2 = False
    while Output2 == False:
        print "1.Balance"
        print "2.Withdraw"
        print "3.Deposit"
        print "4.Exit\n\n"
        try:
            option = input("Please Select From The Menu: ")
        except SyntaxError:
            print "\nINVALID ENTRY, PLEASE TRY AGAIN\n"
            continue
        
        if option in  (1,2,3,4):
            if option == 1:
                print "\nBALANCE\n£" + str (Balance)
                print "\nOVERDRAFT\n£" + str (Overdraft)

                raw_input ("\nPLEASE PRESS ANY KEY TO RETURN TO THE MAIN MENU\n")

            elif option == 2:
                print "\nWITHDRAW\n"
                user_withdraw = raw_input("How Much Would You Like To Withdraw?: ")
                if not user_withdraw or not user_withdraw.isdigit():
                    print "\nERROR\n"
                elif (int(user_withdraw)>(Balance+Overdraft)):
                    print "\nINSUFFIENT FUNDS\n"
                else:   
                    Balance = Balance - int(user_withdraw)
                    print "\n WITHDRAW SUCCESSFUL\n"

                raw_input ("\nPLEASE PRESS ANY KEY TO RETURN TO THE MAIN MENU\n")
                
            elif option == 3:
                print "\nDEPOSIT\n"
                user_deposit = raw_input("How Much Would You Like To Deposit?: ")
                if not user_deposit or not user_deposit.isdigit():
                    print "\nERROR\n"
                elif (int(user_deposit)<(0)):
                    print "\nInvalid SUM\n"
                else:   
                    Balance = Balance + int(user_deposit)
                    print "\n DEPOSIT SUCCESSFUL\n"
                

                raw_input ("\nPLEASE PRESS ANY KEY TO RETURN TO THE MAIN MENU\n")

            else:
                print "\nTHANK YOU & GOOD BYE\n"
                Output2 = True
        
        else:
            print "\nINVALID ENTRY, PLEASE TRY AGAIN\n"
            
            

Hole_On_The_Wall()

3 comments:

  1. I like the idea of showing the program we have created for Programming module

    ReplyDelete
  2. Would be good to compare your code to mine.

    ReplyDelete
  3. CHECKED IT AND IT WORKS

    ReplyDelete