Bank Management System Project In Python With Source Code
By Rohit Sharma
Updated on Dec 03, 2025 | 41 min read | 22.06K+ views
Share:
Working professionals
Fresh graduates
More
By Rohit Sharma
Updated on Dec 03, 2025 | 41 min read | 22.06K+ views
Share:
Table of Contents
Quick Overview:
Now we will build this Bank Management System Project In Python in this guide, along this explore upGrad's expert-curated Data Science Course that can advance your career.
Popular Data Science Programs
When developing a bank management system project in python, it is essential to define the core functionalities that make the application useful. A well-structured python banking project should mimic real-world banking operations, providing a seamless experience for users while maintaining data integrity.
Below are the key features that define a successful banking management system project in python:
| Feature | Description |
| Create New Account | Allows a new user to register by providing their name and an initial deposit. |
| Deposit Money | Enables an existing account holder to add funds to their account. |
| Withdraw Money | Allows an account holder to withdraw funds, with a check for sufficient balance. |
| Check Balance | Displays the current available balance for a specific account. |
| Display Account Details | Shows all information related to an account, including name, account number, and balance. |
| Close an Account | Provides an option to remove an existing account from the system. |
This set of features provides a complete, functional core for our banking system project.
Now that we understand the features, let's dive into the implementation. In this section, we provide a simple banking system in python with source code that you can copy, run, and modify.
We will break the code down into logical blocks, The Account Class, The Bank Class, and the Main Menu, to ensure you understand every part of this python banking system.
Prerequisites
Before we begin, make sure you have a basic understanding of Python's core concepts:
You will also need Python installed on your computer. If you don't have it, you can download it from the official Python website.
You may Read: How to Install Python in Windows (Even If You're a Beginner!)
The best way to structure a project like this is using Object-Oriented Programming (OOP). We will create an Account class to act as a blueprint for every bank account. Each account we create will be an "object" of this class, containing its own specific data (like name and balance).
This class will hold all the information and actions related to a single bank account.
Python
import random
class Account:
def __init__(self, name, initial_deposit):
self.name = name
self.balance = initial_deposit
self.account_number = self.generate_account_number()
print(f"Account for {self.name} created successfully.")
print(f"Your Account Number is: {self.account_number}")
def generate_account_number(self):
# A simple way to generate a 10-digit account number
return ''.join([str(random.randint(0, 9)) for _ in range(10)])
def deposit(self, amount):
if amount > 0:
self.balance += amount
print(f"Deposited ${amount}. New balance: ${self.balance}")
else:
print("Invalid deposit amount.")
def withdraw(self, amount):
if amount > 0 and amount <= self.balance:
self.balance -= amount
print(f"Withdrew ${amount}. New balance: ${self.balance}")
else:
print("Invalid withdrawal amount or insufficient funds.")
def check_balance(self):
print(f"Current balance for account {self.account_number}: ${self.balance}")
def display_details(self):
print("\n--- Account Details ---")
print(f"Account Holder: {self.name}")
print(f"Account Number: {self.account_number}")
print(f"Balance: ${self.balance}")
print("-----------------------")
Code Breakdown:
Also Read: Python Built-in Modules: Supercharge Your Coding Today!
Next, we need the main python code for banking system operations. This Bank class acts as the controller, managing a collection of Account objects. This is where the logic for creating unique accounts and searching for existing users lives.
Python
class Bank:def __init__(self):
self.accounts = {} # A dictionary to store accounts
def create_account(self):
name = input("Enter account holder's name: ")
try:
initial_deposit = float(input("Enter initial deposit amount: $"))
if initial_deposit < 0:
print("Initial deposit cannot be negative.")
return
new_account = Account(name, initial_deposit)
self.accounts[new_account.account_number] = new_account
except ValueError:
print("Invalid input for deposit. Please enter a number.")
def find_account(self, account_number):
return self.accounts.get(account_number)
def close_account(self):
account_number = input("Enter the account number to close: ")
account = self.find_account(account_number)
if account:
print(f"Closing account for {account.name}.")
del self.accounts[account_number]
print("Account closed successfully.")
else:
print("Account not found.")
def perform_transaction(self):
account_number = input("Enter your account number: ")
account = self.find_account(account_number)
if not account:
print("Account not found.")
return
while True:
print("\nTransaction Menu:")
print("1. Deposit")
print("2. Withdraw")
print("3. Check Balance")
print("4. View Account Details")
print("5. Exit Transaction Menu")
try:
choice = int(input("Enter your choice (1-5): "))
if choice == 1:
amount = float(input("Enter amount to deposit: $"))
account.deposit(amount)
elif choice == 2:
amount = float(input("Enter amount to withdraw: $"))
account.withdraw(amount)
elif choice == 3:
account.check_balance()
elif choice == 4:
account.display_details()
elif choice == 5:
break
else:
print("Invalid choice. Please enter a number between 1 and 5.")
except ValueError:
print("Invalid input. Please enter a number.")
Code Breakdown:
Also Read: Class in Python
Finally, we tie everything together with a menu-driven loop. This transforms the classes into an interactive bank management system project in python with source code that users can actually interact with via the terminal.
Python
def main():
my_bank = Bank()
while True:
print("\n===== Welcome to Python Bank =====")
print("1. Create New Account")
print("2. Access Existing Account")
print("3. Close an Account")
print("4. Exit")
try:
choice = int(input("Enter your choice (1-4): "))
if choice == 1:
my_bank.create_account()
elif choice == 2:
my_bank.perform_transaction()
elif choice == 3:
my_bank.close_account()
elif choice == 4:
print("Thank you for using Python Bank. Goodbye!")
break
else:
print("Invalid choice. Please select a valid option.")
except ValueError:
print("Invalid input. Please enter a number.")
if __name__ == "__main__":
main()
Code Breakdown:
This completes the basic structure of our bank management system project in python.
Also Read: Top 50 Python Project Ideas with Source Code in 2025
Data Science Courses to upskill
Explore Data Science Courses for Career Progression
Below is the fully functional script for your bank management system project in python. We have combined the Account class, the Bank class, and the main execution loop into a single, cohesive file. This providing you with a simple banking system in python with source code that is ready to run immediately.
Python
import random
#--------------------------------
# Class for a single bank account
#--------------------------------
class Account:
"""
Represents a single bank account with basic functionalities like
deposit, withdraw, and balance check.
"""
def __init__(self, name, initial_deposit):
self.name = name
self.balance = initial_deposit
self.account_number = self.generate_account_number()
print(f"Account for '{self.name}' created successfully.")
print(f"Your Account Number is: {self.account_number}")
def generate_account_number(self):
"""Generates a random 10-digit account number."""
return ''.join([str(random.randint(0, 9)) for _ in range(10)])
def deposit(self, amount):
"""Deposits a specified amount into the account."""
if amount > 0:
self.balance += amount
print(f"Successfully deposited ${amount:.2f}. New balance: ${self.balance:.2f}")
else:
print("Invalid deposit amount. Please enter a positive number.")
def withdraw(self, amount):
"""Withdraws a specified amount from the account if funds are sufficient."""
if 0 < amount <= self.balance:
self.balance -= amount
print(f"Successfully withdrew ${amount:.2f}. New balance: ${self.balance:.2f}")
else:
print("Invalid withdrawal amount or insufficient funds.")
def check_balance(self):
"""Prints the current balance of the account."""
print(f"Current balance for account {self.account_number}: ${self.balance:.2f}")
def display_details(self):
"""Displays the full details of the account."""
print("\n--- Account Details ---")
print(f"Account Holder: {self.name}")
print(f"Account Number: {self.account_number}")
print(f"Balance: ${self.balance:.2f}")
print("-----------------------")
#--------------------------------
# Class for managing the entire bank
#--------------------------------
class Bank:
"""
Manages all bank accounts and top-level operations like creating,
closing, and accessing accounts.
"""
def __init__(self):
self.accounts = {} # Dictionary to store account_number: Account_object
def create_account(self):
"""Guides the user through creating a new account."""
name = input("Enter account holder's name: ")
if not name.strip():
print("Name cannot be empty.")
return
try:
initial_deposit = float(input("Enter initial deposit amount: $"))
if initial_deposit < 0:
print("Initial deposit cannot be negative.")
return
new_account = Account(name, initial_deposit)
self.accounts[new_account.account_number] = new_account
except ValueError:
print("Invalid input for deposit. Please enter a valid number.")
def find_account(self, account_number):
"""Finds and returns an account object based on the account number."""
return self.accounts.get(account_number)
def close_account(self):
"""Closes an account after confirming with the user."""
account_number = input("Enter the account number to close: ")
account = self.find_account(account_number)
if account:
confirm = input(f"Are you sure you want to close the account for {account.name}? (yes/no): ").lower()
if confirm == 'yes':
del self.accounts[account_number]
print("Account closed successfully.")
else:
print("Account closure cancelled.")
else:
print("Account not found.")
def perform_transaction(self):
"""Handles transactions for an existing customer."""
account_number = input("Enter your account number: ")
account = self.find_account(account_number)
if not account:
print("Account not found. Please check the account number and try again.")
return
print(f"\nWelcome, {account.name}!")
while True:
print("\nTransaction Menu:")
print("1. Deposit")
print("2. Withdraw")
print("3. Check Balance")
print("4. View Account Details")
print("5. Return to Main Menu")
try:
choice = int(input("Enter your choice (1-5): "))
if choice == 1:
amount = float(input("Enter amount to deposit: $"))
account.deposit(amount)
elif choice == 2:
amount = float(input("Enter amount to withdraw: $"))
account.withdraw(amount)
elif choice == 3:
account.check_balance()
elif choice == 4:
account.display_details()
elif choice == 5:
break
else:
print("Invalid choice. Please enter a number between 1 and 5.")
except ValueError:
print("Invalid input. Please enter a number.")
#--------------------------------
# Main execution block
#--------------------------------
def main():
"""The main function to run the bank application."""
my_bank = Bank()
while True:
print("\n===== Welcome to Python Bank =====")
print("1. Create New Account")
print("2. Access Existing Account")
print("3. Close an Account")
print("4. Exit")
try:
choice = int(input("Enter your choice (1-4): "))
if choice == 1:
my_bank.create_account()
elif choice == 2:
my_bank.perform_transaction()
elif choice == 3:
my_bank.close_account()
elif choice == 4:
print("Thank you for using Python Bank. Goodbye!")
break
else:
print("Invalid choice. Please select a valid option.")
except ValueError:
print("Invalid input. Please enter a number.")
if __name__ == "__main__":
main()
This python code for banking system is designed for clarity. You can copy it directly into your IDE (like PyCharm or VS Code) to see how the banking system in python manages data flow between the user and the account objects.
Also Read: How to Run Python Program
Congratulations! You now have a working banking system python project running in your terminal. However, real-world applications rarely stop at the command line. To make your portfolio truly stand out, you can expand this bank management project in python with advanced features.
To save account data, you can write it to a file. The json module is great for this. You'd need functions to save data when the app closes and load it when it starts.
Example Code: First, import json at the top of your file. Then, you could add a save_data method to your Bank class.
Python
# Inside the Bank class
def save_data(self, filename="bank_data.json"):
# We can't save the Account objects directly, so we create a dictionary of their data
data_to_save = {}
for acc_num, account_obj in self.accounts.items():
data_to_save[acc_num] = {
'name': account_obj.name,
'balance': account_obj.balance
}
with open(filename, 'w') as f:
json.dump(data_to_save, f, indent=4)
print("Data saved successfully.")
You would call my_bank.save_data() before the program exits. You'd also need a corresponding load_data function to run when the program starts.
Also Read: How to Open a JSON File? A Complete Guide on Creating and Reading JSON
Command-line interfaces are functional, but GUIs are much more user-friendly. You can use Python's built-in Tkinter library to create a simple visual interface.
Example Code: This is a very basic example of what a Tkinter window looks like.
Python
import tkinter as tk
def create_gui():
window = tk.Tk()
window.title("Python Bank")
window.geometry("400x300")
greeting_label = tk.Label(window, text="Welcome to Python Bank!", font=("Arial", 16))
greeting_label.pack(pady=20)
create_account_btn = tk.Button(window, text="Create Account")
create_account_btn.pack(pady=10)
# You would link buttons to your bank functions here
window.mainloop()
# You could call create_gui() instead of the command-line main()
# create_gui()
A real banking system keeps a record of all transactions. You can add this by creating a list within your Account class to store a log of every deposit and withdrawal.
#Inside the Account class's init method, add:
self.transactions = []
#Modify the deposit method:
def deposit(self, amount): if amount > 0: self.balance += amount self.transactions.append(f"Deposit: +${amount:.2f}") # Log the transaction print(f"Deposited ${amount:.2f}. New balance: ${self.balance:.2f}") # ... rest of the method
#Add a new method to display the history:
def display_transactions(self): print("\n--- Transaction History ---") if not self.transactions: print("No transactions found.") else: for transaction in self.transactions: print(transaction) print("--------------------------")
Our current project has some error handling, but you can make it more specific. For instance, what if a user tries to withdraw a non-numeric value? Using a try-except block for every input is good practice.
Example Code: Here is a more robust way to handle numeric input.
Python
# In the perform_transaction method, when asking for amount:
try:
amount_str = input("Enter amount to deposit: $")
amount = float(amount_str)
account.deposit(amount)
except ValueError:
print("Invalid amount. Please enter a valid number (e.g., 50.75).")
This try-except block specifically catches the ValueError that occurs if the user types letters instead of numbers, providing a clearer error message.
By implementing these enhancements, you can transform this simple program into a much more comprehensive and impressive banking system project.
Also Read: Python Tkinter Projects [Step-by-Step Explanation]
A Bank Management System is a software application that digitizes and manages all the core operations of a bank. Think of it as the backbone that allows customers to open accounts, deposit money, withdraw cash, and check their balances without manual paperwork. It ensures that all transactions are recorded accurately and that customer data is stored securely and can be accessed easily.
For developers, building a bank management system project in python is an excellent exercise. Python's simple syntax and powerful features make it an ideal language for this task. This project doesn't just teach you how to write code; it teaches you how to think logically and structure an application.
Also Read: AI in Data Science: What It Is, How It Works, and Why It Matters Today
Subscribe to upGrad's Newsletter
Join thousands of learners who receive useful tips
Building a bank management system project in python is a rewarding experience that reinforces many core programming principles. You have successfully created an application that handles essential banking operations using object-oriented principles. You started by designing an Account class, managed multiple accounts with a Bank class, and tied it all together with an interactive command-line menu.
The real learning begins when you start extending this project. We encourage you to try implementing the enhancements suggested above, such as adding data persistence or a graphical user interface. Every new feature you add will deepen your understanding and make your portfolio stronger. Keep experimenting, keep coding, and continue building your skills.
Still confused is this a good project for you? upGrad offers personalized career counseling to help you choose the best project for you. You can also visit your nearest upGrad center to gain hands-on experience through expert-led courses and real-world projects.
Similar Reads:
The main purpose is to create a software application that automates core functionalities like account creation and balance management. For learners, a bank management system project in python serves as an excellent practical exercise to apply fundamental concepts like OOP, data structures, and user input handling in a real-world scenario.
Yes, building a banking system project in python is highly recommended for beginners. The step-by-step approach of creating classes for accounts and managing them with a simple menu makes the logic easy to follow. It bridges the gap between learning syntax and building a functional application.
In any robust python banking project, unique IDs are essential. You can use Python's random module to generate a sequence, or for a professional touch, use the uuid module. This ensures that every customer in your system has a distinct identifier, preventing data conflicts.
For a basic banking management system project in python, saving data to a text or CSV file is a good start. However, to make it scalable, we recommended integrating a database like SQLite or MySQL. This ensures customer records persist even after you close the program.
Security is vital. When developing your bank management system project in python with source code, start by adding PIN authentication for transactions. You should also "hash" passwords using libraries like hashlib before storing them, ensuring that sensitive user data is never kept in plain text.
To enhance your simple banking system in python with source code, you can use libraries like Tkinter for a graphical interface, SQLite3 for database management, and Pandas if you want to generate financial reports. These tools take your project from a basic script to a professional application.
Absolutely. If you are building a bank management system project in python with mysql source code, you can add an apply_interest() function. This would query the database for all savings accounts, calculate interest based on the balance, and update the records automatically.
OOP is the backbone of any organized python code for banking system structure. It allows you to model entities like 'Account' and 'Customer' as objects. This makes your code reusable and easier to debug, as each object manages its own data (like balance and name) independently.
A dictionary is used in a banking system in python because it offers instant lookups. By using the unique account number as the key, the system can retrieve customer details immediately without searching through thousands of records, which is crucial for performance.
Yes. To transform a local script into an online banking system project with source code, you would need to move the logic to a web framework like Django or Flask. This allows multiple users to log in and perform transactions simultaneously via a web browser.
In this context, Account is the class—the blueprint defining what an account is. When you actually register a user in your banking system python project, you create an object—an instance of that class with specific data like "John Doe" and his unique balance.
A basic simple banking system in python runs sequentially in the console. To handle multiple users at once, you would need to implement threading or, better yet, deploy the application on a server where a web framework manages concurrent user sessions.
You can add a list called self.transactions inside your Account class. Every time a deposit or withdrawal happens in your python banking system, append the details to this list. You can then create a method to print this log, serving as a mini bank statement.
The self parameter is a reference to the current object. In any python banking system, self ensures that when you call a method like withdraw, it affects only the specific account you are working with, not every account in the bank.
You can use inheritance. Create a parent Account class with shared features, then create child classes like SavingsAccount and CurrentAccount. This is a classic feature of a bank management system in python, allowing different rules for interest and overdrafts.
While high-frequency trading often uses C++, a bank management system in python is excellent for backend services, data analysis, and web apps. Many fintech companies use Python for its speed of development and powerful data processing libraries.
To add transfers to your bank management project in python, create a function that takes two account numbers. It should atomically withdraw from the sender and deposit to the receiver, ensuring funds aren't lost if one step fails.
A common mistake in a bank management system project in python is using global variables to store accounts. This makes the code messy and hard to debug. Always use a dedicated Bank class to manage the collection of Account objects.
Yes. You can use tools like PyInstaller to bundle your banking system python project into a single .exe file. This allows users to run your banking application on their computers without needing to install Python separately.
Yes. You can enhance your project by using Python's requests library to fetch live data from a currency API. This allows your bank management system in python to handle multi-currency deposits or show real-time exchange rates to users.
840 articles published
Rohit Sharma is the Head of Revenue & Programs (International), with over 8 years of experience in business analytics, EdTech, and program management. He holds an M.Tech from IIT Delhi and specializes...
Speak with Data Science Expert
By submitting, I accept the T&C and
Privacy Policy
Start Your Career in Data Science Today
Top Resources