This Python project is a simple Bank Management System that simulates creating and managing bank accounts. It allows users to create accounts, deposit or withdraw funds, and check their balance. The project also demonstrates the use of Object-Oriented Programming (OOP) concepts like classes, methods, and instance variables.
Before starting this project, ensure you have a basic understanding of the following concepts:
By the end of this project, you will:
To run this project, you need:
import random
class Bank():
Bname = "Renaissance Bank"
clients = []
def updateUser(self, client):
self.clients.append(client)
def authenticate(self, name, account_number, password):
auth = False
for i in self.clients:
if (i.account["name"] == name and
i.account["accno"] == account_number and
i.account["password"] == password):
auth = True
return i
print("Wrong credentials")
return False
class Client():
account = {}
def __init__(self, name, deposit, password):
self.account["name"] = name
self.account["deposit"] = deposit
self.account["accno"] = random.randint(100000, 999999)
self.account["password"] = password
print(f"Your account has been created, account number is: {self.account['accno']}")
def deposit(self, amnt):
self.account["deposit"] += amnt
print("Deposit successful")
def withdraw(self, amnt):
if self.account["deposit"] >= amnt:
self.account["deposit"] -= amnt
print("Withdrawal successful")
else:
print("Insufficient funds")
def check(self):
print(f"Balance: {self.account['deposit']} rupees")
def main():
bank = Bank()
print(f"Hello and welcome to {bank.Bname}")
flag = True
while flag:
print("""What would you like to do:
1.) Create a new account
2.) Inquire existing account
3.) Exit""")
choice = int(input("Press 1, 2, or 3: "))
if choice == 1:
name = input("Enter name: ")
deposit = int(input("Enter deposit amount: "))
password = input("Enter password: ")
client = Client(name, deposit, password)
bank.updateUser(client)
elif choice == 2:
name = input("Enter name: ")
account_number = int(input("Enter account number: "))
password = input("Enter password: ")
current_client = bank.authenticate(name, account_number, password)
if current_client:
print("""What would you like to do:
1.) Deposit
2.) Withdraw
3.) Check balance
4.) Exit""")
choice = int(input("Press 1, 2, 3, or 4: "))
if choice == 1:
amount = int(input("Enter deposit amount: "))
current_client.deposit(amount)
elif choice == 2:
amount = int(input("Enter withdrawal amount: "))
current_client.withdraw(amount)
elif choice == 3:
current_client.check()
else:
print("Thank you for visiting")
else:
print("Authentication failed")
else:
flag = False
print("Thank you")
return "Bye"
if __name__ == "__main__":
main()
import random
class Bank():
Bname = "Renaissance Bank"
clients = []
def updateUser(self, client):
self.clients.append(client)
def authenticate(self, name, account_number, password):
auth = False
for i in self.clients:
if (i.account["name"] == name and
i.account["accno"] == account_number and
i.account["password"] == password):
auth = True
return i
print("Wrong credentials")
return False
class Client():
account = {}
def __init__(self, name, deposit, password):
self.account["name"] = name
self.account["deposit"] = deposit
self.account["accno"] = random.randint(100000, 999999)
self.account["password"] = password
print(f"Your account has been created, account number is: {self.account['accno']}")
def deposit(self, amnt):
self.account["deposit"] += amnt
print("Deposit successful")
def withdraw(self, amnt):
if self.account["deposit"] >= amnt:
self.account["deposit"] -= amnt
print("Withdrawal successful")
else:
print("Insufficient funds")
def check(self):
print(f"Balance: {self.account['deposit']} rupees")
def main():
bank = Bank()
print(f"Hello and welcome to {bank.Bname}")
flag = True
while flag:
print("""What would you like to do:
1.) Create a new account
2.) Inquire existing account
3.) Exit""")
choice = int(input("Press 1, 2, or 3: "))
if choice == 1:
name = input("Enter name: ")
deposit = int(input("Enter deposit amount: "))
password = input("Enter password: ")
client = Client(name, deposit, password)
bank.updateUser(client)
elif choice == 2:
name = input("Enter name: ")
account_number = int(input("Enter account number: "))
password = input("Enter password: ")
current_client = bank.authenticate(name, account_number, password)
if current_client:
print("""What would you like to do:
1.) Deposit
2.) Withdraw
3.) Check balance
4.) Exit""")
choice = int(input("Press 1, 2, 3, or 4: "))
if choice == 1:
amount = int(input("Enter deposit amount: "))
current_client.deposit(amount)
elif choice == 2:
amount = int(input("Enter withdrawal amount: "))
current_client.withdraw(amount)
elif choice == 3:
current_client.check()
else:
print("Thank you for visiting")
else:
print("Authentication failed")
else:
flag = False
print("Thank you")
return "Bye"
if __name__ == "__main__":
main()
1. Initialize a Bank class to store bank name and client data.
2. Create a Client class to manage each client’s information.
3. In the main() function, create an interactive menu that asks the user to:
o Create a new account: This will prompt the user for name, deposit, and password and create a client object.
o Inquire an existing account: This allows the user to deposit, withdraw, or check balance.
4. For each action, authenticate the user by comparing their credentials.
1. Initialize a Bank class to store bank name and client data.
2. Create a Client class to manage each client’s information.
3. In the main() function, create an interactive menu that asks the user to:
o Create a new account: This will prompt the user for name, deposit, and password and create a client object.
o Inquire an existing account: This allows the user to deposit, withdraw, or check balance.
4. For each action, authenticate the user by comparing their credentials.
Office:- 660, Sector 14A, Vasundhara, Ghaziabad, Uttar Pradesh - 201012, India