Computer science
Computer science
if email_exists(email):
print("Email already exists!")
return None
# Customer login
def customer_login():
global customer_id
email = input("Enter your email address: ")
password = input("Enter your password: ")
order_id = cursor.lastrowid
cursor.execute("INSERT INTO order_tracking
(order_id, tracking_id, status, mestamp) VALUES (%s,
%s, %s, NOW())", (order_id, tracking_id, order_status))
conn.commit()
cursor.close()
conn.close()
automa c_order_status_update(tracking_id)
return tracking_id
return None
# Automa cally update order status through stages
def automa c_order_status_update(tracking_id):
status_stages = ["Order Received", "Preparing for
Dispatch", "Out for Delivery", "Delivered"]
cursor.close()
conn.close()
if orders:
print("Your Order History:")
for order in orders:
print(f"Tracking ID: {order[0]}, Status:
{order[1]}")
else:
print("No orders found.")
cursor.close()
conn.close()
if new_name:
cursor.execute("UPDATE customers SET name =
%s WHERE customer_id = %s", (new_name,
customer_id))
if new_email:
cursor.execute("UPDATE customers SET email =
%s WHERE customer_id = %s", (new_email,
customer_id))
if new_mobile:
cursor.execute("UPDATE customers SET mobile =
%s WHERE customer_id = %s", (new_mobile,
customer_id))
conn.commit()
print("Account details updated successfully.")
cursor.close()
conn.close()
# Cancel an order
def cancel_order():
tracking_id = input("Enter the tracking ID of the
order to cancel: ")
if cursor.rowcount > 0:
print(f"Order with tracking ID {tracking_id} has
been cancelled.")
else:
print(f"No order found with tracking ID
{tracking_id}.")
cursor.close()
conn.close()
# Main func on
def main():
while True:
print("\n1. Create Customer Account")
print("2. Login as Customer")
print("3. Place Order")
print("4. Golden Member Subscrip on")
print("5. View Order History")
print("6. Update Account Details")
print("7. Cancel Order")
print("8. View Packages")
print("9. Logout")
print("10. Exit")
if __name__ == "__main__":
main()
OUTPUT
BIBLIOGRAPHY
● The Complete Reference Python byMar n C. Brown
from Mc. GrawHill publica ons.
. ● www.geeksforgeeks.org
● www.python.org