Have you ever used an ATM to check your balance or withdraw money? Of course you have! But have you ever thought about building your own ATM project in Python? If you’ve already learned the basics of Python, this is the perfect mini-project to test your knowledge.

This project will use everything you’ve learned so far:
And the best part? It’ll feel like you’re building a real-world application.
Let’s dive in – chai in hand, Python open, and logic ready!
What You’ll Learn
By the end of this project, you’ll be able to:
- Simulate a user login with a PIN
- Display a simple ATM menu
- Handle deposit, withdrawal, and balance check
- Use loops and conditions to manage logic
All of this, using simple Python!
Project Description
We’ll create a text-based ATM system with the following features:
- Ask user for a 4-digit PIN to login
- Once logged in, display a menu with options:
- Check Balance
- Deposit Money
- Withdraw Money
- Exit
- Perform actions based on the selected option
- Continue the loop until the user exits
We’ll use basic variables to store the user’s balance and validate inputs with conditions.
Let’s start coding!
Full Code: ATM Simulator
# ATM Simulator in Python
# Initial balance and PIN
balance = 10000
pin_code = "1234"
# Welcome message
print("Welcome to SmartTejas ATM")
# Login process
pin_attempts = 0
while pin_attempts < 3:
entered_pin = input("Enter your 4-digit PIN: ")
if entered_pin == pin_code:
print("\nLogin successful!\n")
break
else:
pin_attempts += 1
print("Incorrect PIN. Try again.")
if pin_attempts == 3:
print("\nToo many incorrect attempts. ATM locked. Contact customer service.")
else:
# Main ATM menu
while True:
print("==== MENU ====")
print("1. Check Balance")
print("2. Deposit")
print("3. Withdraw")
print("4. Exit")
choice = input("\nChoose an option (1-4): ")
if choice == "1":
print(f"\nYour current balance is ₹{balance}\n")
elif choice == "2":
amount = input("Enter amount to deposit: ")
if amount.isdigit():
balance += int(amount)
print(f"Deposit successful. New balance: ₹{balance}\n")
else:
print("Invalid input. Please enter numbers only.\n")
elif choice == "3":
amount = input("Enter amount to withdraw: ")
if amount.isdigit():
amount = int(amount)
if amount <= balance:
balance -= amount
print(f"Withdrawal successful. New balance: ₹{balance}\n")
else:
print("Insufficient balance.\n")
else:
print("Invalid input. Please enter numbers only.\n")
elif choice == "4":
print("\nThank you for using SmartTejas ATM. Goodbye!")
break
else:
print("Invalid choice. Please select a valid option.\n")
👉 isdigit()
is used to check if the entered amount is a number (contains only digits). This prevents errors when the user inputs letters or symbols instead of a numeric value. It’s a simple way to validate input before converting it to an integer.
Sample Output
Welcome to SmartTejas ATM
Enter your 4-digit PIN: 1234
Login successful!
==== MENU ====
1. Check Balance
2. Deposit
3. Withdraw
4. Exit
Choose an option (1-4): 1
Your current balance is ₹10000
Choose an option (1-4): 2
Enter amount to deposit: 2000
Deposit successful. New balance: ₹12000
Choose an option (1-4): 3
Enter amount to withdraw: 3000
Withdrawal successful. New balance: ₹9000
Choose an option (1-4): 4
Thank you for using SmartTejas ATM. Goodbye!
Code Explanation
Let’s break it down so you understand every part:
1. Setting Initial Values
balance = 10000
pin_code = "1234"
We assume the user has an initial balance of ₹10,000 and a 4-digit PIN “1234”.
2. PIN Authentication
pin_attempts = 0
while pin_attempts < 3:
entered_pin = input("Enter your 4-digit PIN: ")
We give the user 3 chances to enter the correct PIN. If wrong, ATM locks.
3. Main Menu (Loop)
while True:
print("==== MENU ====")
This loop keeps running until the user chooses to exit.
4. Check Balance
if choice == "1":
print(f"Your current balance is ₹{balance}")
Simple display of current balance.
5. Deposit Money
amount = input("Enter amount to deposit: ")
if amount.isdigit():
balance += int(amount)
Checks if input is a number, then adds to balance.
6. Withdraw Money
if amount <= balance:
balance -= amount
else:
print("Insufficient balance.")
Only allows withdrawal if user has enough funds.
7. Exit
elif choice == "4":
break
Breaks the loop and ends the program.
Project Tips & Ideas
- You can make it more secure by using
getpass
to hide PIN input. - Add sound or delays using
time.sleep()
for better UX. - Add account numbers or multiple users in future versions!
- Want to turn this into a GUI? Try
tkinter
orPyQt
after basics.
Final Thoughts
This ATM Simulator might look simple, but it’s a powerful project that pulls together multiple foundational Python concepts. By completing it, you’ve practiced:
- User input
- Logic building
- Looping
- Conditional handling
- Arithmetic
And most importantly, you took one step closer to becoming a Python developer!
Keep practicing, keep building.
Next up: We’ll create more real-world mini-projects as you learn about functions, data structures, and file handling.
Happy coding!
What’s Next?
In the next post, we’ll learn about the Functions in Python