CS File
CS File
PROJECT FILE
To-Do List Using python and MySQL
Delhi Public School, Indira Nagar, Lucknow, has satisfactorily completed the PROJECT
I am immensely grateful for the opportunity to present this project on creating a To-Do List application
using Python and MySQL. This project has been a significant learning experience, and I would like to
express my sincere appreciation to everyone who contributed to its successful completion.
First and foremost, I would like to extend my heartfelt gratitude to my project advisor, Mrs.Pinkie
Srivastava, for their continuous guidance, patience, and support throughout the duration of this project.
Their expertise and encouragement played a pivotal role in shaping the direction and quality of the
work presented here. Their constructive feedback and insightful suggestions helped me overcome
numerous challenges and enhanced my understanding of both Python programming and database
management with MySQL.
I would also like to thank Delhi Public School,Indiranagar for providing me with the necessary
resources and facilities that enabled me to work effectively on this project. The access to relevant
software, hardware, and academic materials was instrumental in bringing this project to fruition.
Furthermore, I would like to acknowledge the contributions of my classmates and peers, whose
discussions and collaborative spirit enriched my learning experience. Their willingness to share
knowledge and exchange ideas was invaluable during the development phases of this project.
My deepest appreciation also goes to my family, whose unwavering support and understanding have
been my constant source of strength. They have always been there to encourage me during the
challenging moments, and their belief in my abilities has been a motivating force throughout this
journey.
In addition, I would like to recognize the contributions of the open-source community and the
developers behind the Python and MySQL libraries. The comprehensive documentation, forums, and
online resources provided by this community were indispensable in overcoming technical challenges
and refining the functionality of the To-Do List application.
I also want to extend my gratitude to the numerous online tutorials, blogs, and educational platforms
that provided guidance and inspiration during the project. The wealth of information available online
greatly facilitated the learning process and allowed me to explore various programming techniques and
database management strategies.
Finally, I am thankful to all those who directly or indirectly supported me in the completion of this
project. This experience has been incredibly rewarding, and I am confident that the knowledge and
skills I have gained will serve me well in my future endeavors.
Thank you.
The To-Do List application is a command-line based tool developed using Python and MySQL. Its primary function
is to help users manage tasks efficiently by allowing them to create, view, update, and delete tasks through a simple
command-line interface.
Project Objectives
• Task Management: Users can manage tasks by adding, viewing, updating, and deleting them, with all data
stored persistently in a MySQL database.
• Command-Line Interface: The application is entirely CLI-based, offering a lightweight and efficient way to
interact with the task management system.
• Database Integration: MySQL is used to store and manage task data, ensuring data persistence across
sessions.
Technologies Used
Features
• Add, View, Update, Delete Tasks: Users manage tasks directly from the command line.
• Search and Filter: Allows filtering tasks by criteria like deadlines and priority.
The project enhanced my skills in Python programming, database management with MySQL, and command-line
application development. It provided valuable experience in creating a robust and user-friendly non-GUI application.
Conclusion
This project showcases the integration of Python and MySQL in a command-line environment, delivering a practical
tool for task management. The experience gained is foundational for future software development projects, especially
in backend and database-driven applications.
Coding:
import mysql.connector
def add_task():
task = input("Enter task: ")
query = "INSERT INTO tasks (task) VALUES (%s)"
cursor.execute(query, (task,))
cnx.commit()
print("Task added successfully!")
def view_tasks():
query = "SELECT * FROM tasks"
cursor.execute(query)
tasks = cursor.fetchall()
if not tasks:
print("No tasks available.")
else:
for task in tasks:
print(f"{task[0]}. {task[1]}")
def delete_task():
if not view_tasks():
print("No tasks available.")
else:
task_id = int(input("Enter task number to delete: "))
query = "DELETE FROM tasks WHERE id = %s"
cursor.execute(query, (task_id,))
cnx.commit()
print("Task deleted successfully!")
def main():
while True:
def main():
while True:
print("\n--- To-Do List ---")
print("1. Add Task")
print("2. View Tasks")
print("3. Delete Task")
print("4. Exit")
choice = input("Choose an option: ")
if choice == "1":
add_task()
elif choice == "2":
view_tasks()
elif choice == "3":
delete_task()
elif choice == "4":
print("Goodbye!")
break
else:
print("Invalid choice. Please try again.")
if __name__ == "__main__":
main()
Commands: