CSC project
CSC project
(Computer Science)
CERTIFICATE
`
CERTIFICATE
DATE PRINCIPAL
INTERNALEXAMINER EXTERNALEXAMINER
`
ACKNOWLEDGEMENT
`
ACKNOWLEDGEMENT
guiding and providing facilities towards the successful outcome of this project
work.
We wish to express our deep and profound sense of gratitude to our guide
We also express our sincere gratitude to one and all who directly or
CONTENTS
`
CONTENTS
1 AIM 1
2 3
INTRODUCTION TO PYTHON
3 INTRODUCTION TO PROJECT 6
4 REQUIREMENTS 8
5 PROJECT ANALYSIS 10
6 CODING 12
7 OUTPUT 20
8 SUGGESTED
IMPROVEMENTS 26
9 BIBLIOGRAPHY 28
`
AIM
`
AIM
The software is user-friendly. There will not be any difficulties to the user
to handle the data by this software. And that is my main motive, to present data
in an organized manner.
1
`
INTRODUCTION TO PYTHON
`
INTRODUCTION TO PYTHON
BENEFITS OF PYTHON:
Python can connect to database systems. It can also read and modify files.
Python can be used to handle big data and perform complex mathematics.
Python has syntax that allows developers to write programs with fewer
lines than some other programming languages.
3
`
Python has syntax that allows developers to write programs with fewer
lines than some other programming languages.
Python was designed for readability, and has some similarities to the
English language with influence from mathematics.
4
`
INTRODUCTION:
6
`
REQUIREMENT
`
REQUIREMENTS
HARDWARE REQUIRED:
Processor :PENTIUM(ANY)
RAM :512MB+
SOFTWARE REQUIRED:
Python
8
`
PROJECT ANALYSIS
`
PROJECT ANALYSIS
10
`
CODINGS
`
zz
CODINGS
import mysql.connector as m
con = m.connect(host="localhost",user="root",password="root")
cur = con.cursor()
print("-" * 100)
print("Welcome to Movie hub")
print("-" * 100)
print("Hi guzz...<3")
print("Hope your doing good")
print("Yup!!! shall we start !?")
print("Lezz go.......")
cur.execute("use Moviehub")
def create_acc():
cur.execute("select max(UID)from user")
data = cur.fetchone()
if data[0] is None:
UID = 1
else:
UID = data[0] + 1
name = input("Enter your name:")
age = int(input("Enter your age:"))
gender = input("Enter your gender(m/f):")
password = input("enter your password:")
conpass = input("Enter the password again:")
role = "user"
if password == conpass:
cur.execute("insert into user values({},'{}',{},'{}','{}','{}')".format(UID, name, age,
gender,password, role))
con.commit()
print(name, "have successfully create an account")
else:
print("the password have mismatched")
def login():
while True:
username = input("Enter username:")
password = input("Enter your password:")
12
`
if data == None:
print("password not found retry")
elif data[0] == password:
print()
print("Successfully logined")
print()
cur.execute("Select UID from user where Name='{}'".format(username))
UID = cur.fetchone()
return UID[0]
break
else:
print("Something went wrong")
def display_movie():
cur.execute("Select * from movie")
data = cur.fetchall()
for i in data:
print(i)
def view_profile(UID):
cur.execute("select * from user where UID={}".format(UID))
data = cur.fetchone()
print()
print(data)
print()
def edit_personal_profile(UID):
name = input("Enter your name:")
age = int(input("Enter your age:"))
gender = input("Enter your gender (m/f):")
cur.execute("update user set Name='{}',age={},gender='{}' where
UID={}".format(name, age, gender, UID))
con.commit()
print("The data's has been updated")
13
`
def add_wishlist(UID):
while True:
cur.execute("select * from movie")
data = cur.fetchall()
for i in data:
print(i)
def remove_wishlist():
while True:
MID = int(input("Enter MID of the movie to be removed:"))
cur.execute("select * from wishlist where MID={}".format(MID))
print(cur.fetchone())
conf = input("is the data select correct(y/n):")
if conf == "n":
continue
elif conf == "y":
cur.execute("Delete from wishlist where MID={}".format(MID))
print(MID, "data's are removed from wishlist")
break
def update_status():
while True:
MID = int(input("Enter Mid of the movie status to be update:"))
cur.execute("select * from wishlist where MID={}".format(MID))
data = cur.fetchone()
14
`
if data[0] == None:
continue
else:
status = input("Enter new status:")
cur.execute("update wishlist set status = '{}' where MID={}".format(status, MID))
print("Updated")
break
def update_pass():
UID= login()
n_password = input("Enter new password:")
cur.execute("update user set password ='{}' where UID={}".format(n_password,UID))
print("password updated successfully")
def add_movie():
cur.execute("select max(MID) from movie")
data = cur.fetchone()
print(data)
if data[0] == None:
MID = 1
else:
MID = data[0] + 1
print(MID)
Mname = input("Enter movie name:")
genre = input("enter genre:")
description = input("Enter description:")
duration = input("Enter duration (nhm(minutes)):")
cur.execute(
"insert into movie values(MID,Mname,genre,description,duration)".format(MID,
Mname, genre, description, duration))
con.commit()
print(Mname, "add successfully")
def remove_movies():
while True:
15
def update_movie():
while True:
MID = int(input("Enter the MID to be updated:"))
cur.execute("select * from movie where MID={}".format(MID))
print(cur.fetchone())
ch = input("Enter is this the movie to be made change(y/n):")
if ch == "n":
continue
elif ch == "y":
Mname = input("Enter movie name:")
genre = input("Enter movie genre:")
description = input("Enter description:")
duration = input("Enter duration:")
cur.execute("update movie set
Mname='{}',genre='{}',description='{}',duration='{}' where MID={}".format(MID))
con.commit()
print("Updated successfully")
break
def view_user_account():
cur.execute("select * from user")
data = cur.fetchall()
for i in data:
print()
16
print(i)
`
def main():
print("started")
while True:
m1 = int(input("Enter your choice\n [1] create account \n [2] login \n [3] quit \n
[login to proceed after creating account]\n enter your choice:"))
if m1 == 1:
create_acc()
elif m1 == 2:
UID = login()
while True:
17
if a1 == 1:
`
add_movie()
elif a1 == 2:
remove_movies()
elif a1 == 3:
update_movie()
elif a1 == 4:
view_user_account()
elif a1 == 5:
update_pass()
elif a1 == 6:
break
else:
continue
elif m1 == 3:
print("Thank you for visiting")
break
else:
continue
if __name__ =="__main__":
main()
18
`
OUTPUT
`
OUTPUT
----------------------------------------------------------------------------------------------------
Welcome to Movie hub
----------------------------------------------------------------------------------------------------
Hi guzz...<3
Hope you're doing good
Yup!!! shall we start !?
Lezz go.......
20
`
[5] remove_wishlist
[6] update_wishlist_status
[7] update_pass
[8] back
Enter your choice: 1
(1, 'Inception', 'Sci-Fi', 'A thief who steals corporate secrets.', '148min')
(2, 'Titanic', 'Romance', 'A love story that transcends tragedy.', '195min')
(3, 'Avengers', 'Action', 'Earth's mightiest heroes unite.', '143min')
Enter your choice: 3
(1, 'Inception', 'Sci-Fi', 'A thief who steals corporate secrets.', '148min')
(2, 'Titanic', 'Romance', 'A love story that transcends tragedy.', '195min')
(3, 'Avengers', 'Action', 'Earth's mightiest heroes unite.', '143min')
21
`
Updated.
Enter your choice: 7
Admin John has successfully created an account with the role: admin.
22
`
Enter MID: 3
(3, 'Avengers', 'Action', 'Earth's mightiest heroes unite.', '143min')
Is this the movie to be removed (y/n): y
Successfully removed.
Do you want to continue removing (y/n): n
Enter your choice: 3
Updated successfully.
Enter your choice: 4
23
`
24
`
SUGGESTED IMPROVEMENTS
`
SUGGESTED IMPROVEMENT
And to make the usage of the software at more ease and inclusion of
software experience.
26
`
BIBLIOGRAPHY
`
BIBLIOGRAPHY
BOOKS REFERRED:
Website : https://www.python.org
Website : https:// www.google.com
Website : https://www.mysql.com
Website : https://code.visualstudio.com
28