import getpass from getpass import getpass #library to get password in invisible chars print " Welcome to CyberAcademy Bank " print " To access your account please enter your credentials " user = raw_input("Username :") # get the username passwd = getpass("Password :") # get the password # authentication # authenticating if the credentials are correct if user == "Cyber" and passwd == "Academy": print "Welcome Mr.{}".format(user) auth = "true"; # setting a variable to save the result of the authentication else: print "Invalid credentials" auth = "false"; # capturing the result of a false authentication balance = 1234.50; # default placeholder balance if auth == "true": # checking if authentication was successful to move on print " Options Available :" print "[1] Account Status " print "[2] Deposit" print "[3] Withdraw" opt = raw_input() else: pass # if authentication was not successful terminate if opt == "1": # if option 1 display user info print "Account owner {}".format(user) print "Total amount {}".format(balance) elif opt == "2": # amnt=raw_input("Amount to deposit :") # get the amount to deposit from user total = balance + float(amnt) # geting the amount from the user and casting it to float and calculating the new balance balance =total # setting the new balance print "Total Available {}".format(total) elif opt == "3": amnt = raw_input(" Amount to withdraw: ") status_a = balance - float(amnt) # getting the amount from the user to cast the amount to float if status_a < 0: # if the requested value is larger that the value available break operation print "The amount required is not possible" else: balance = balance - float(amnt) # calculate the new balance after withdrawl print " Amount left : {}".format(balance) else: print "Option not available"