ATM Project
Welcome to the ATM Project by Krishna Singh Soni
Articles
Article 1: Introduction to ATM Project
The ATM Project by Krishna Singh Soni is a Python-based program that simulates an automated teller machine (ATM). It allows users to create an account, deposit and withdraw money, modify account details, and perform other banking operations.
Article 2: How to Use the ATM
To use the ATM Project, follow these steps:
- Select the desired option from the main menu.
- Follow the prompts to perform the chosen operation.
- If you encounter any issues, refer to the Help section for troubleshooting or contact customer support.
Article 3: Frequently Asked Questions
Q: How can I create an account?
A: To create an account, select the "Create an account" option from the main menu and provide the required information.
Q: How can I deposit money?
A: Choose the "Deposit cash" option and follow the prompts to enter the desired amount.
Q: How can I withdraw money?
A: Select the "Withdraw amount" option and enter the desired amount to withdraw.
Q: How can I modify my account details?
A: Choose the "Modify account details" option and follow the prompts to update your information.
Q: How can I get help or contact support?
A: In case of any issues or queries, refer to the Help section or contact our customer support at 123-456-7890.
Usage Guidelines and Attribution Notice
Dear Users,
Attribution:
You are welcome to use this code. If you find it helpful, I kindly request you to provide credit by mentioning the source.
Academic Projects:
If you are using it for a school project, please include this website in your Bibliography. Thank you!
Sharing:
Feel free to share this code with your friends or colleagues who might find it useful.
Collaboration and knowledge sharing are highly encouraged.
Feedback and Support:
If you encounter any issues or have suggestions for improving the code,
we would be grateful if you could contact us. Your feedback helps us enhance the quality and usability of our resources.
Thank you for your understanding and cooperation. Happy coding!
Best regards,
Krishna
ATM Project Code
ATM Project Code
#---S.R Global School---#
#---A.T.M project by Krishna Singh Soni---#
#---XII A2---#
#--Roll no:- 18--#
import random
import time
#--------Global lists---------#
# Sample data for testing purposes
name = ["Krishna", "Updesh","Priyanshu Singh"]
phon_no = ["1234567890", "9876543210", "7890567987"]
add = ["Los Angles", "Milky way galaxy", "Kya karoge jan kar"]
pin_list = ["1234", "5678","9012"]
cash = [1000000,2000,3000]
acc_id = [1001, 1002, 1003] # Assuming account IDs are already exists
#--------- !? ---------#
phon_new = 0
pin_limit = 0
p1 = 0
account_id = 0
n = 0
acc_ID_2 = 0
#---------------Home---------------#
def home():
print('''
1. Create an account
2. Already have an accou4nt
3. Delete an existing account
4. Help
5. Exit
''')
try:
ch = input("Choose an option: ")
if ch == "1":
print()
acc_crtn()
elif ch == "2":
print()
alrdy_ve_acc()
elif ch == "3":
delete_acc()
elif ch == "4":
show_help()
elif ch == "5":
print(f"\t\n````Thank you for visiting.````")
return
else:
print("Invalid choice.")
home()
except ValueError:
print("\n \t Invalid choice.")
print("\t Choose the valid choice again")
home()
#------- Start_timer -----------#
def start_timer():
print("")
for i in range(0, 2):
flush = True
time.sleep(1)
#----------- Random ID Generator -----------#
def rndom_id():
global account_id
while True:
account_id = random.randint(1000, 9999)
if account_id not in acc_id:
print("\n Accoount created succesfully")
break
#----------- Initial_Amount ------------#
def initial_amt():
amt = input("Enter the initial deposit amount (minimum $500): ")
if not amt.isdigit():
print("Please enter initial amount.")
initial_amt()
elif int(amt) < 500:
print("Insufficient initial deposit. Minimum deposit is $500.")
initial_amt()
else:
cash.append(amt)
#----------- PIN lenth and Is digit Checker ------------#
def pin_checker():
pin = str(input("Create your 4-digit pin: "))
if len(pin) != 4 or not pin.isdigit():
print("\tInvalid pin")
print("\tPin should have 4 digits")
pin_checker()
else:
pin_list.append(pin)
#----------- Phone Number Checker ------------#
def phn_checker_2():
global phon_new
phon_new = [] # Initialize as an empty list or dict
phon_new.append(str(input("Enter your valid phone number: ")))
if len(phon_new) != 10 or not phon_new.isdigit():
print("Invalid number")
phn_checker_2()
def verify_phone_no():
global p1
p1 = str(input("Enter your valid phone number: "))
print("Verifying phone number ")
if len(p1) == 10 and p1.isdigit():
n = 3
for i in range(n):
print(f".", end='', flush=True)
time.sleep(1)
n= n - 1
print('Phone number verified')
phon_no.append(p1)
else:
n = 3
for i in range(n):
print(f".", end='', flush=True)
time.sleep(1)
n= n - 1
text = " Inavaid phone number \n Please enter 10 digit valid phone number"
print(f"\n{text}\n")
verify_phone_no()
#-------- Account creation ----------#
def acc_crtn():
global i, p1, account_id
print("\t`Creating an account`")
while True:
n = str(input("Enter your name: "))
verify_phone_no()
a = str(input("Enter your valid address: "))
if n != "" and p1 != "" and a != "":
name.append(n.title())
add.append(a.title())
break
else:
print("Name or Phone number or Address cannot be empty")
pin_checker()
initial_amt()
rndom_id()
acc_ID = account_id
acc_id.append(acc_ID)
for n in range(0,len(acc_id)):
if acc_ID == acc_id[n]:
("\n\t``Account Details:``\n")
print(" Account ID: ", acc_id[n])
print(" Name: ", name[n])
print(" Phone number:", phon_no[n])
print(" Address: ", add[n])
print(" Pin: ", pin_list[n])
print(" Cash: $", str(cash[n]).strip())
home()
#----------Deposition of Cash----------#
def deposition():
global n
pin = input("Enter your PIN: ")
if pin == pin_list[n]:
amt = input("Enter amount to deposit: $")
if int(amt) > 0:
current_cash = cash[n]
new_cash = int(current_cash) + int(amt)
cash[n] = new_cash
print("Amount succesfully deposited")
print(f"Current Balance: ${new_cash}\n")
elif int(amt) == 0:
print("\nCash can not be '0' like your empty brain\n")
elif int(amt) > 10000000000:
print("\Sorry!, You can't deposite more than 1 Billion.\n")
elif int(amt) == "":
print("Cash can not be empty")
else:
print("\n\t`Invalid amount type`\n")
elif pin == "":
print("PIN can not be empty")
deposition()
else:
print("")
print("\t``Incorrect PIN``")
deposition()
#----------Withdrawal Cash-----------#
def withdrawal():
global n
pin = input("\nEnter your PIN: ")
if pin == pin_list[n]:
amt = int(input("Enter amount to be withdraw: $"))
if not amt < 0 and amt < cash[n]:
current_cash = cash[n]
new_cash = int(current_cash) - int(amt)
cash[n] = new_cash
print("Amount succesfully Withdrew")
print(f"Current Balance: ${new_cash}\n")
elif amt > cash[n]:
print("Insufficient Balance")
account_details()
elif amt == 0:
print("\nDont withdraw 0 amount like your empty brain")
else:
print("\n\t`Invalid amount type`\n")
elif pin == "":
print("PIN can not be empty")
withdrawal()
elif int(pin)== 1:
account_details()
else:
print("")
print("\t``Incorrect PIN``\n")
withdrawal()
#-----------Modify Account-------------#
def modify_acc():
global n
pin = input("\nEnter your PIN: ")
if pin == pin_list[n]:
print('''
1. Update Name
2. Update Phone number
3. Update Address
4. Update Pin
5. Exit
''')
while True:
try:
print("\n\t`Select what you want to change`")
ch = int(input("Enter your choice: "))
if ch == 1:
name[n] = input("Enter your name to be changed: ")
print(f"New name {name[n]}")
print("Name updated succesfully")
elif ch == 2:
while True:
phon_new = input("Enter new phone number")
if len(phon_new) == 10 and phon_new.isdigit():
phon_no[n] = phon_new
print(f"New phone number: {phon_no[n]}")
print("Phone number updated successfully")
break
else:
print("Invalid phone number")
elif ch == 3:
add[n] = input("Enter your address to be changed: ")
print(f"New address {add[n]}")
print("Address updated succesfully")
elif ch == 4:
pin = input("Please comfirm it's you by comfirming your pin: ")
if pin == pin_list[n]:
new_pin = input("Enter your pin to be changed: ")
if len((new_pin)) == 4 and pin_list[n].isdigit():
pin_list[n] = new_pin
print(f"New PIN {pin_list[n]}")
print("PIN updated succesfully")
else:
print("\n\t`Invalid pin`")
print("\tPin should have 4 digits\n")
elif pin == "":
print("PIN can not be empty")
modify_acc()
else:
print("")
print("\t``Incorrect PIN``")
elif ch==5:
account_details()
else:
print("\n\t``Invalid choice``")
except ValueError:
print("\n\t``Invalid choice``")
elif pin == "":
print("PIN can not be empty")
modify_acc()
elif int(pin)== 1:
account_details()
else:
print("")
print("\t``Incorrect PIN``")
print("\t To go back, '1'\n")
modify_acc()
#--------------Account details------------#
def account_details():
global n
print('''
1. Account details
2. Deposit cash
3. Withdraw amount
4. Modify account details
5. Exit
''')
while True:
try:
ch = int(input("Enter your choice: "))
if ch==1:
print("\n\t``Account Details:``\n")
print(" Account ID: ", acc_id[n])
print(" Name: ", name[n])
print(" Phone number: ", phon_no[n])
print(" Address:", add[n])
print(" Pin: ", pin_list[n])
print(" Cash: $", str(cash[n]).strip())
print("\n")
elif ch==2:
deposition()
elif ch == 3:
withdrawal()
elif ch==4:
modify_acc()
elif ch ==5:
home()
else:
print("\n\t`Invalid choice.`\n")
except ValueError:
print("\n\t``Invalid choice``")
#------------ Already have an account ------------#
def alrdy_ve_acc():
global n
print("To go home, '0'")
acc_ID_2 = input("Enter Account ID: ")
acc_ID_found = False
for n in range(len(acc_id)):
if acc_ID_2 == str(acc_id[n]):
acc_ID_found = True
break
## print(n)
if acc_ID_found:
## print(n)
while True:
pin = input("\nEnter your PIN: ")
if pin == pin_list[n]:
account_details()
else:
print("")
print("``Incorrect PIN``\n")
elif int(acc_ID_2)==0:
home()
else:
print("Account not found")
alrdy_ve_acc()
#-----Help Section--------#
def show_help():
print("\n\t`Welcome to the ATM Help Section.`\n")
print("1. Instructions: Find information on how to use the ATM.")
print("2. Troubleshooting: Get help with common errors or issues.")
print("3. Frequently Asked Questions (FAQs): Find answers to common queries.")
print("4. Contact Support: Get in touch with our customer support team.")
print("5. Return to the main menu.")
print("\n")
while True:
choice = input("Enter your choice (1-5): ")
if choice == "1":
print("\nInstructions:")
print("1. To create an account, select the 'Create an account' option and follow the prompt." )
print("2. To withdraw money, select the 'Withdraw' option and follow the prompts.")
print("3. To check your account balance, select the 'Account Details' option.")
print("4. To modify your account details, select the 'Modify account details' option and follow the prompt")
print("\n")
enter = input("Press 'Enter' to go back")
show_help()
elif choice == "2":
print("\nTroubleshooting:")
print("1. If your card is not being recognized, make sure it is inserted correctly.")
print("2. If you forgot your PIN, you can reset it by contacting our support team.")
enter = input("Press 'Enter' to go back")
show_help()
elif choice == "3":
print("\n")
print("\t`Welcome to the Help Section!`\n")
print("Here are some frequently asked questions and their answers:")
print("\n")
print("1. How can I change my PIN?")
print(" To change your PIN, follow these steps:")
print(" - Select the 'Modify account details' option from the main menu.")
print(" - Enter your current PIN for verification.")
print(" - Choose the 'Pin' option to change your PIN.")
print(" - Enter your new 4-digit PIN when prompted.")
print(" - Your PIN will be updated successfully.")
print("\n")
print("2. What should I do if my card is lost or stolen?")
print(" If your card is lost or stolen, it is important to take immediate action to protect your account. Follow these steps:")
print(" - Contact our customer service helpline at 9100000000 or 9200000000 as soon as possible to report the loss or theft.")
print(" - Provide your account details and any relevant information about the incident.")
print(" - Our customer service representative will assist you in blocking your card to prevent unauthorized access.")
print(" - They will guide you through the process of issuing a new card and transferring your funds to the new card.")
print(" - It is crucial to act quickly to minimize any potential unauthorized transactions on your account.")
print("\n")
print("If you have any further questions or concerns, please feel free to submit your query below:")
submit_query = input("Do you want to submit a query? (y/n): ")
if submit_query.lower() == "y":
name = input("Enter your name: ")
phone_number = input("Enter your phone number: ")
query = input("Enter your query: ")
# Saving the query in a file
with open("queries.txt", "a") as file:
file.write("Name: " + name.title() + "\n")
file.write("Phone Number: " + phone_number + "\n")
file.write("Query: " + query + "\n")
file.write("\n")
print("Thank you for submitting your query. We will get back to you soon!")
start_timer()
show_help()
else:
print("No query submitted.")
start_timer()
show_help()
elif choice == "4":
print("\nContact Support:")
print("Customer Support Phone: 9100000000, 9200000000")
print("Customer Support Email: support@krishssbank.com")
enter = input("Press 'Enter' to go back")
show_help()
elif choice == "5":
print("\nReturning to the main menu.")
home()
else:
print("Invalid choice. Please select a number from 1 to 5.")
#-----Delete Account--------#
def delete_acc():
global n
print("To go home entre '0'")
surity = input("Are you sure want to delete your account (y/n): ")
if surity.lower() == 'n':
home()
else:
acc_ID = input("Enter the account ID to delete: ")
pin = input("Enter your PIN: ")
index = -1 # Initialize index as -1
for n in range(len(acc_id)):
if acc_ID == str(acc_id[n]) and pin == str(pin_list[n]):
index = n
break
if index != -1:
print("\nAccount found. Deleting account...")
print("Reason for deleting the account:")
print("1. Account closure")
print("2. Security concerns")
print("3. Switching to another bank")
print("4. Other")
reason = input("Enter the reason number (1-4): ")
if reason == "1":
problem = "Account closure"
elif reason == "2":
problem = "Security concerns"
elif reason == "3":
problem = "Switching to another bank"
elif reason == "4":
problem = "Other"
else:
home()
# Show the amount being withdrawn from the account
amount = cash[index]
print("\nWithdrawing amount:", amount)
# Storing the problem, account details, and withdrawn amount in a file
with open("deleted_account_details.txt", "a") as file:
file.write(f"Account ID: {acc_id[index]}\n")
file.write(f"Name: {name[index]}\n")
file.write(f"Phone number: {phon_no[index]}\n")
file.write(f"Address: {add[index]}\n")
file.write(f"Problem: {problem}\n")
file.write(f"Withdrawn Amount: {amount}\n")
file.write("------------------------------\n")
# Deleting the account details from the lists
del name[index]
del phon_no[index]
del add[index]
del pin_list[index]
del cash[index]
del acc_id[index]
print("\nAccount deleted successfully.")
start_timer()
home()
else:
print("\nInvalid account ID or PIN.")
home()
#--------- Start----------#
print(" \n")
print("\n")
print("-------------------- Welcome to --------------------")
print("------------------ Krishss A.T.M -------------------")
print("------------------ P.v.t, L.t.d --------------------")
print("---------------9100000000, 9200000000---------------")
print("---------------krishssbannk@gmail.com---------------")
print("\n")
home() #Calling home
# ...
0 Comments