atm_System
atm_System
atm_System
Acknowledgement
certificate
Intriduction of project
Source Code
import mysql.connector
def connect_to_db():
return mysql.connector.connect(
host="localhost",
user="root",
password="12345",
database="atm_system"
db = connect_to_db()
cursor = db.cursor()
user = cursor.fetchone()
db.close()
if user:
else:
return None
def check_balance(account_number):
db = connect_to_db()
cursor = db.cursor()
cursor.execute(query, (account_number,))
balance = cursor.fetchone()
db.close()
if balance:
return balance[0]
else:
return None
db = connect_to_db()
cursor = db.cursor()
db.commit()
db.close()
db = connect_to_db()
cursor = db.cursor()
current_balance = check_balance(account_number)
if current_balance is None:
db.commit()
db.close()
def atm_system():
if user:
print(f"Welcome {account_number}!")
while True:
print("\nATM Menu:")
print("4. Exit")
if choice == 1:
balance = check_balance(account_number)
elif choice == 2:
deposit(account_number, amount)
elif choice == 3:
print(result)
elif choice == 4:
break
else:
else:
if __name__ == "__main__":
atm_system()
Output
Main Screen
Account Menu
Check balance
Deposit Money
Withdraw Money
Exit
Mysql Database and Tables used in this project
Structure of table
Insert the record