|
| 1 | +import random |
| 2 | +class BankGame : |
| 3 | + @staticmethod |
| 4 | + def main( args) : |
| 5 | + print("---WELCOME TO ELIX BANKING SERVICES---") |
| 6 | + print("") |
| 7 | + print("________________________") |
| 8 | + print("Enter your name: ") |
| 9 | + name = input() |
| 10 | + # I am inserting do loop to make the program run forever under correct inputs. |
| 11 | + print("Hi, " + name + "\bWelcome to my program!") |
| 12 | + print("____________________________") |
| 13 | + print("Do you want to start/repeat the program?") |
| 14 | + print("Enter Y for Yes and N for No: ") |
| 15 | + temp = input()[0] |
| 16 | + passw = 4758 |
| 17 | + bal = 10000 |
| 18 | + leftbal = 0 |
| 19 | + print("If you don\'t know the password refer the first line of the program") |
| 20 | + print("Please enter the password: ") |
| 21 | + # Condition when the statement goes true i.e.- temp equals 1 |
| 22 | + while True : |
| 23 | + if (temp == 'Y' or temp == 'y') : |
| 24 | + if (passw == 4758) : |
| 25 | + print("") |
| 26 | + print("Your initial account balance is Rs. 10000") |
| 27 | + # Using for statement to perform 5 operation on each login |
| 28 | + x = 0 |
| 29 | + while (x <= 6) : |
| 30 | + print("0. Exit") |
| 31 | + print("1. Deposit") |
| 32 | + print("2. Withdraw") |
| 33 | + print("3. Change passcode") |
| 34 | + print("4. Check balance") |
| 35 | + print("5. Customer care") |
| 36 | + print("Enter the serial no. of your choice") |
| 37 | + choice = int(input()) |
| 38 | + print("Enter captha to verify that you are not a robot.") |
| 39 | + captha = random.randrange(10000) |
| 40 | + print(captha) |
| 41 | + print("Enter the number shown above: ") |
| 42 | + verify = int(input()) |
| 43 | + if (verify == captha) : |
| 44 | + # If captha gets matched, then these switch statements are executed. |
| 45 | + if (choice==0): |
| 46 | + print("BYE!......" + name + " HAVE A NICE DAY!") |
| 47 | + print("__________________________") |
| 48 | + print("@author>[@programmer-yash") |
| 49 | + print("Please comment here or open an issue if you have any queries or suggestions!") |
| 50 | + print("") |
| 51 | + print("#hacktoberfest") |
| 52 | + return 0 |
| 53 | + elif(choice==1): |
| 54 | + print("You have chosen to deposit.") |
| 55 | + print("Enter the amount to deposit : ") |
| 56 | + deposit = int(input()) |
| 57 | + bal = bal + deposit |
| 58 | + print(str(deposit) + " has been deposited to your account.") |
| 59 | + print("Left balance is " + str(bal)) |
| 60 | + elif(choice==2): |
| 61 | + print("You have chosen to withdraw.") |
| 62 | + print("Enter the amount to be withdrawn") |
| 63 | + withdraw = int(input()) |
| 64 | + print(str(+withdraw) + " has been withdrawn from your account.") |
| 65 | + bal = bal - withdraw |
| 66 | + print("Check the cash printer.") |
| 67 | + print("Left balance is " + str(bal)) |
| 68 | + elif(choice==3): |
| 69 | + print("You have chosen to change passcode.") |
| 70 | + print("Enter the current passcode: ") |
| 71 | + check = int(input()) |
| 72 | + if (check == passw) : |
| 73 | + print("Enter the new passcode") |
| 74 | + newP = int(input()) |
| 75 | + passw = newP |
| 76 | + print("Your new password is " + str(newP)) |
| 77 | + else : |
| 78 | + print("Wrong passcode!") |
| 79 | + elif(choice==4): |
| 80 | + print("You have chosen to check balanace.") |
| 81 | + print("Your current account balance is " + str(bal)) |
| 82 | + elif(choice==5): |
| 83 | + print("You have chosen for customer care.") |
| 84 | + print("Contact us at:") |
| 85 | + print(" Email: yash197911@gmail.com") |
| 86 | + else: |
| 87 | + print("Wrong choice!!! Choose again...!") |
| 88 | + else : |
| 89 | + print("xCAPTHA NOT CORRECTx") |
| 90 | + x += 1 |
| 91 | + continue |
| 92 | + elif(temp == 'N' or temp == 'n') : |
| 93 | + print("BYE!......" + name + " HAVE A NICE DAY!") |
| 94 | + print("__________________________") |
| 95 | + print("@author>[@programmer-offbeat]") |
| 96 | + print("Please comment here if you have any queries or suggestions!") |
| 97 | + print("--OR--") |
| 98 | + print("create an issue") |
| 99 | + print("I will rightly see and reply to your messages and suggestions!") |
| 100 | + print() |
| 101 | + print("HAPPY CODING!:-)") |
| 102 | + return 0 |
| 103 | + else : |
| 104 | + print("Err!..... You have entered a wrong choice!") |
| 105 | + print("Try again....!") |
| 106 | + # Comdition if password mismatches. |
| 107 | + if (passw != 4758) : |
| 108 | + print("You have entered wrong password.....Try again!") |
| 109 | + if((temp < 100) == False) : |
| 110 | + break |
| 111 | + |
| 112 | + |
| 113 | +if __name__=="__main__": |
| 114 | + BankGame.main([]) |
0 commit comments