Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

Scope and Aim of the Project:

To create a to-do list application that can be used to


organize, increase productivity, and reduce anxiety
caused by a plethora of tasks. Using this application
users can create their own account, add tasks to
individual to-do lists, and manage various accounts and
to-do lists.
Front-end software:

Back-end Data Base:


What is Python???
Python is a high-level, interpreted, object-oriented language
with dynamic semantics. The straightforward syntax of
Python makes it easier to learn and enhances readability,
which lowers software maintenance costs.
Code reuse and software modularity are encouraged by
Python's support for modules and packages. Because there is
no compilation phase and the edit-test-debug cycle is
extremely quick, Python also delivers enhanced productivity.
Python's capacity for introspection is demonstrated by the
fact that the debugger is developed in the language.
What is MySQL???
Relational database management system (RDBMS) MySQL is
available as an open-source software.Its name is an amalgam
of "SQL," an acronym for Structured Query Language, and
"My," the name of co-founder Michael Widenius's daughter.
Data is arranged in one or more data tables in a relational
database, where the data may be related to one another.
This helps to structure the data. Programmers utilize the SQL
language to manage user access to the relational database
and to create, edit, and extract data from it. A relational
database can be implemented in a computer's storage
system through the use of an RDBMS like MySQL, which also
works with an operating system to manage users, permit
network access, test database integrity, and make backups
easier.

Database Connectivity:
To create a connection between the MySQL database and
Python, the connect() method of mysql. connector module is
used. We pass the database details like HostName,
username, and password in the method call, and then the
method returns the connection object.
Database Structure:
Tables:

tdlcommunity:

tdldata:
Project code and output:
Database connectivity:
import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root",
passwd="root",database="todolist")
if mydb.is_connected():
mycursor=mydb.cursor()
print('successfully connected')
Code:
import mysql.connector

mydb=mysql.connector.connect(host="localhost",user="root",passwd="root",da
tabase="todolist")

if mydb.is_connected():

mycursor=mydb.cursor()

print('successfully connected')

print('''1.add user account

2.show user details

3.update your to-do-list

4.drop task from to do list

5.delete user account

6.show task details''')


x=int(input("enter your choice:"))

while True:

#adding a new userID and username to create a new user account in database

if(x==1):

userid=int(input("create your userID:"))

un=input("create a username:")

sqlinsert="insert into tdlcommunity values("+str(userid)+",'"+un+"')"

mycursor.execute(sqlinsert)

mydb.commit()

print("data updated")

break

#show user's details from the database

elif(x==2):

mycursor=mydb.cursor()

mycursor.execute("select*from tdlcommunity")

data=mycursor.fetchall()

for i in data:

print(i)

break

#adding a task to your to-do-list

elif(x==3):
userID=int(input("enter your user ID:"))

task_details=input("enter your task:")

due_date=input("enter task due date:")

task_status=input("is your task completed or due?:")

sqlinsert="INSERT INTO tdldata (userID, task_details, due_date, task_status)


VALUES (%s, %s, %s, %s)"

mycursor.execute(sqlinsert,(userID, task_details, due_date, task_status))

mydb.commit()

print("task added to to-do-list")

break

#delete a task from to-do-list created by user

elif(x==4):

userid=int(input("enter your user ID:"))

task=input("please enter the task you want to delete:")

sqldelete="delete from tdldata where userID=%s and task_details=%s;"

delete_values=(userid,task)

mycursor.execute(sqldelete,delete_values)

mydb.commit()

print("task deleted from your to-do-list")

break

#delete an account created by user


elif(x==5):

userid=int(input("enter your user ID:"))

username=input("enter your username:")

sqldel=("delete from tdlcommunity where userID='"+str(userid)+"'")

sqldel2=("delete from tdlcommunity where username='"+username+"'")

sqldel3=("delete from tdldata where userID='"+str(userid)+"'")

mycursor.execute(sqldel)

mycursor.execute(sqldel2)

mycursor.execute(sqldel3)

mydb.commit()

print("user deleted")

break

#show task details entered by the user

elif(x==6):

userID=int(input("enter your userID="))

sql="select
tdldata.userID,tdldata.task_details,tdldata.task_status,tdldata.due_date,tdlcomm
unity.userID,tdlcommunity.username from tdldata JOIN tdlcommunity on
tdldata.userID=tdlcommunity.userID where
tdlcommunity.userID='"+str(userID)+"'"

mycursor.execute(sql)

r=mycursor.fetchall()
mydb.commit()

print(r)

break

Output:
1.Add user account:

2. show user details:


3. update to-do list:

4. drop task from to-do list:

5. delete user account:


6. show task details:
Bibliography
https://ca.indeed.com/career-advice/career-
development/daily-to-do-list
https://www.python.org/doc/essays/blurb/
https://www.geeksforgeeks.org/how-to-connect-python-
with-sql-database/
https://ncert.nic.in/textbook.php?leip1=1-7

You might also like