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