Priyanka Final Project
Priyanka Final Project
KANAKAPURA, KARNATAKA
PRACTICAL FILE
For
AISSCE 2025 Examination
[As a part of the Computer Science Course (083)]
SUBMITTED BY
PRIYANKA LATH
JAIN INTERNATIONAL RESIDENTIAL SCHOOL
KANAKAPURA, KARNATAKA
Examination 2025.
………………………… ……………………………..
Signature of External Examiner Signature of Internal Examiner
CONTENTS
SL.No Date Name Of Program Page Remarks
No.
1 10 – 6 – 22 RANDOM NUMBER 1
GENERATOR
PYTHON PROGRAMS
>>PROGRAM 1
AIM: Write a program to enter two numbers and print the sum,
difference, product and quotient of the two numbers.
SOURCE CODE:
a=int(input("enter the 1st no"))
b=int(input("enter the 2nd no"))
p=a*b
s=a+b
d=a-b
q=a/b
print("the product:",p,"the sum:",s,"the difference:",d,"the quotient:",q)
OUTPUT:
enter the 1st no20
enter the 2nd no5
the product: 100 the sum: 25 the difference: 15 the quotient: 4.0
>>PROGRAM 2
AIM: Write a program to accept a number and print if the number is an
Armstrong number or not.
SOURCE CODE:
a=int(input("enter the number:"))
s=0
l=len(str(a))
t=a
while t>0:
b=t%10
s+=b**l
t//=10
if a==s:
print("the no is armstrong no”)
else:
print(“the no is not Armstrong no”)
OUTPUT:
enter the number:153
the no is armstrong n0
>>PROGRAM 3
AIM:Write a program to accept a number and print if the number is a
prime number or not.
SOURCE CODE:
a=int(input("enter the number"))
if a==2:
print("the number is prime")
elif a%2==0:
print("the no is prime")
else:
print("the no is prime no")
OUTPUT:
enter the number40
the no is prime
>>PROGRAM 4
AIM:Write a program to create a function factorial to accept a number
and print the factorial of the number.
SOURCE CODE:
def factorial():
p=1
a=int(input("enter the no:"))
for i in range(1,a+1):
p=p*i
print(p)
factorial()
OUTPUT:
enter the no:5
120
factorial()
>>PROGRAM 5
AIM:Write a program to create a function words to accept a string and
print the number of words in the string, function palindrome to
print if the string is palindrome and function count to count the
occurrence of the letter ‘T’ in the string.
SOURCE CODE:
def stringop():
sum=1
x=0
a=input(“enter the string:”)
for i in range(0,len(a)):
if(a[i]==” “):
sum+=1
if(a[i]==”t”):
x+=1
if(a[::-1]==a):
z=”palindrome”
else:
z=”not palindrome”
return(sum,x,z)
a1,b1,c1=stringop()
print(“the number of words=”,a1)
print(“the number of t’s=”,b1)
print(c1)
OUTPUT:
enter the string: prasun the great gamer
the number of words= 5
the number of t’s= 2
not palindrome
>>PROGRAM 6
AIM: 6. A Program to enter a list of elements and pass the list to a
function and display the elements and index of the non-zero
elements.
SOURCE CODE:
def index_list(l):
t=[]
for i in range(0,len(l)):
if l[i]!=0:
t.append(i)
return(t)
d=eval(input(“enter”))
print(index_list(d))
OUTPUT:
enter[10,2,3,22,50]
[0, 1, 2, 3, 4]
>>PROGRAM 7
AIM: A program to find area of different shapes using user defined
functions.
SOURCE CODE:
choice="yes"
def circle():
r=int(input("enter the radius"))
print("area=",r**2)
def rectangle():
l=int(input("enter the length"))
b=int(input("enter the breadth"))
print("area=",l*b)
def square():
s=int(input("enter the side"))
print("area",s**2)
def triangle():
h=int(input("enter the height"))
b=int(input("enter the base"))
print("area=",1/2*b*h)
while(choice=="yes"):
print("1.area of circle")
print("2.area of rectangle")
print("3.area of square")
print("4.area of triangle")
choice1=int(input("enter:"))
if choice1==1:
circle()
if choice1==2:
rectangle()
if choice1==3:
square()
if choice1==4:
triangle()
choice=input("do you want to continue(yes/no)")
OUTPUT:
1.area of circle
2.area of rectangle
3.area of square
4.area of triangle
enter:2
enter the length12
enter the breadth14
area 168
do you want to continue(yes/no)no
>>PROGRAM 8
AIM: A program to read a text file line by line and display each word
separated by a #.
SOURCE CODE:
y=open(r'C:\Users\students\Desktop\nike.txt','r')
x=y.read()
z=x.split()
for i in z :
print(i,end='#')
OUTPUT:
Nike’s#inception#in#the#1950s#was#driven#by#track#coach#Bill#Bowerm
an's#quest#for#superior#running#shoe#designs,#facing#initial#challenges#in#
securing#manufacturing#partners#
>>PROGRAM 9
AIM: Read a text file and display the number of
vowels/consonants/capital and small letters.
SOURCE CODE:
y=open(r'C:\Users\students\Desktop\cs.txt',"r")
x=y.read()
v=0
c=0
l=0
u=0
for i in x :
if i >= 'a' and i<= 'z' :
l=l+1
elif i in ('a','e','i','o','u') :
v=v+1
elif i >= 'A' and i<='Z':
u=u+1
print(l)
print(v)
print(u)
OUTPUT:
168
0
3
>>PROGRAM 10
AIM: A program to remove all the lines that contain the character ‘a’ in a file
and write it to another file.
SOURCE CODE:
k=[]
y=open(r'C:\Users\students\Desktop\nike.txt',"r")
z=open(r"C:\Users\students\Desktop\newfile.txt","w")
x=y.readlines()
for i in x :
if 'a' not in i :
k.append(i)
z.writelines(k)
z.close()
OUTPUT:
>>PROGRAM 11
AIM: A Program to read a text file and count the number of
occurrence of a word in the text file.
SOURCE CODE:
y=open(r'C:\Users\students\Desktop\nike.txt',"r")
a=input("enter the word:")
x=y.read()
c=x.split()
s=0
for i in c:
if i==a:
s=s+1
print("the occurence of the word",a,"is",s)
OUTPUT
enter the word:in
the occurence of the word in is 2
>>PROGRAM 12
AIM: Create a binary file with roll number and name. Input a roll
number and search the student with a specific roll number and
display the details.
SOURCE CODE:
import pickle
l=[]
def writing():
y=open("stu.dat","wb")
for i in range(1,3):
n=int(input("roll no"))
na=input("name")
l.append([n,na])
pickle.dump(l,y)
y.close()
def reading():
y=open("stu.dat","rb+")
n=int(input("roll no"))
p=y.tell()
a=pickle.load(y)
na=input("name")
for i in a:
if(i[0]==n):
print i[0]
print i[1]
y.close()
def display():
y=open("stu.dat","rb+")
a1=pickle.load(y)
print(a1)
writing()
reading()
display()
OUTPUT:
roll no1234
nameprasun
roll no2345
nameshriram
roll no1235
namepratibha
[[1234, 'prasun '], [2345, 'shriram']]
>>PROGRAM 13
AIM: Program to create the csv file which should contains the
employee details and to search the particular employee based on
emp no and display the details.
SOURCE CODE:
import csv
def addrec():
with open('cs.csv','w',newline='') as f:
b=csv.writer(f)
b.writerow(['UserID','Password'])
ans='y'
while ans in 'Yy':
print('Enter Login Details:')
uID=input("Enter the UserID:")
p=input("Enter the Password :")
b.writerow([uID,p])
ans=input("Do you want to add another record(y/n):")
print("record stored")
def searchrec():
with open('cs.csv','r') as f:
b=csv.reader(f)
ans='y'
while ans in 'Yy':
found=False
uID=input('Enter the UserID which you want to search:')
for r in b:
if str(uID)==str(r[0]):
print("User ID:",r[0],'\nPassword :',r[1])
found=True
break
if found==False:
print('Record not found')
ans=input("Do you want to search another record(y/n):")
addrec()
searchrec()
OUTPUT:
Enter Login Details:
Enter the UserID:3333
Enter the Password :1234
Do you want to add another record(y/n):n
record stored
Enter the UserID which you want to search:3333
User ID: 3333
Password : 1234
Do you want to search another record(y/n):n
>>PROGRAM 15
AIM: Program to create the csv file which should contains the employee
details and to search the particular employee based on emp no and display
the details.
SOURCE CODE:
import csv
def addrec():
with open('login.csv','w',newline='') as f:
b=csv.writer(f)
b.writerow(['UserID','Password'])
ans='y'
while ans in 'Yy':
print('Enter Login Details:')
uID=input("Enter the UserID:")
p=input("Enter the Password :")
b.writerow([uID,p])
ans=input("Do you want to add another record(y/n):")
print("record stored")
def searchrec():
with open('login.csv','r') as f:
b=csv.reader(f)
ans='y'
while ans in 'Yy':
found=False
uID=input('Enter the UserID which you want to search:')
for r in b:
if str(uID) in r:
print("User ID:",r[0],'\nPassword :',r[1])
found=True
break
if found==False:
print('Record not found')
ans=input("Do you want to search another record(y/n):")
addrec()
searchrec()
OUTPUT:
Enter employ details:
Enter the emp no:1525
Enter emp name :piriyanka attitude
Enter emp salary:10
Do you want to add another record(y/n):y
Enter employ details:
Enter the emp no:1234
Enter emp name :prasun
Enter emp salary:100000000
Do you want to add another record(y/n):n
record stored
Enter the emp no which you want to search:1525
Emp no: 1525
Emp name : piriyanka attitude
Emp salary: 10
Do you want to search another record(y/n):n
>>PROGRAM 16
AIM: A program to implement the concept of stack.
SOURCE CODE:
l=[]
def push():
n=int(input("enter"))
l.append(n)
print(l)
def pop():
if l==[] or len(l) == 0:
print('stack empty')
else:
l.pop()
def disp():
if l==[]:
print('the stack is empty')
else:
print(l[::-1])
def peak():
if l==[]:
print("stack empty")
else:
print(l[-1])
choice = 'yes'
while choice == 'yes':
print('1.push')
print('2.pop')
print('3.display')
print('4.peak')
choice1 = input('enter the choice')
if choice1 == '1':
push()
elif choice1 == '2':
pop()
elif choice1 == '3':
disp()
elif choice1 == '4':
peak()
choice = input('do you want to continue')
OUTPUT:
1.push
2.pop
3.display
4.peak
enter the choice1
enter11
[11]
do you want to continueno
>>PROGRAM 17
AIM: A Program to create a product table and insert and display
data.
SOURCE CODE:
import mysql.connector as dd
y=
dd.connect(host="localhost",user="root",password="jirs",charset="u
tf8",database="school")
x=y.cursor()
def ins():
for i in range(0,3):
pid=int(input("id of the product "))
pname=input("name of product")
price=input("price")
c="insert into product values(%s,%s,%s);"
t=(pid,pname,price)
x.execute(c,t)
y.commit()
def display():
q="select * from product where pid = 12;"
x.execute(q)
for i in x :
print(i)
ins()
display()
OUTPUT:
id of the product 12
name of productpen
price100
id of the product 11
name of productpencil
price50
id of the product 13
name of productbook
price300
(12, 'pen', 100)
>>PROGRAM 18
AIM: A Program to update and display the data after modifying
table.
SOURCE CODE:
import mysql.connector as dd
y=dd.connect(host="localhost",user="root",password="jirs",charset=
"utf8",database="school")
x=y.cursor()
def update1 ():
pid=int(input('pid:'))
pname=input('pname:')
price=input('price:')
q="update product set price = %s,pname = %s where pid = %s ;"
t=(price,pname,pid)
x.execute(q,t)
y.commit()
def display():
q="select * from product ;"
x.execute(q)
for i in x :
print(i)
update1()
display()
OUTPUT:
pid:12
pname:pens
price:1000
(12, 'pens', 1000)
(11, 'pencil', 50)
(13, 'book', 300)
>>PROGRAM 19
AIM: A Program to display the table then delete a certain row from
the table.
SOURCE CODE:
import mysql.connector as dd
y=
dd.connect(host="localhost",user="root",password="jirs",charset="u
tf8",database="school")
x=y.cursor()
def delete1():
pid=int(input("enter the product id:"))
q="delete from product where pid=%s;"
t=(pid,)
x.execute(q,t)
y.commit()
def display():
q="select * from product;"
x.execute(q)
for i in x :
print(i)
display()
delete1()
display()
OUTPUT:
(12, 'pens', 1000)
(11, 'pencil', 50)
(13, 'book', 300)
enter the product id:11
(12, 'pens', 1000)
(13, 'book', 300)
>>PROGRAM 20
AIM: A Program to display the records of the products if the price is
more than 1000.
SOURCE CODE:
import mysql.connector as dd
y=dd.connect(host="localhost",user="root",password="jirs",charset=
"utf8",database="school")
x=y.cursor()
def disp2():
q="select * from product where price >= 1000;"
x.execute(q)
for i in x :
print(i)
disp2()
OUTPUT:
(12, 'pens', 1000)
MYSQL QUERIES
>>PROGRAM 1:
create database employee;
use employee;
create table workers (accno int,cust_name varchar(25),fd_amount
int,months int,int_rate float,fd_date date);
insert into workers values (1001,'priyanka',300000,36,6.00,2018-07-
01);
insert into workers values (1002,'prasun',200000,48,6.75,'2018-03-
22');
insert into workers values (1003,'shriram',400000,36,5.00,'2018-03-
01');
insert into workers values (1004,'nayo',100000,40,5.55,'2020-01-
01');
select * from workers;
1 to display the details about all the fixed deposits whose interest
rate is not entered.
output
empty set
2. to display the account number and fd amount of all the fixed
deposits that are started before 01-04-2018
output
accno fd_amount
1001 300000
1002 200000
1003 400000
3. To display the customer name and fd amount for all the fixed
deposits which do not have a number of months as 36.
| cust_name | fd_amount |
| prasun | 200000 |
| nayo | 100000
OUTPUT
empty set
5. to display the details about all the fixed deposits which started
in the year 2018.
OUTPUT
7.To display the Customer name and FD amount for all the loans for
which thenumber of months is 24,36 or 48(using in operator)
select cust_name,fd_amount from workers where months=24 or
months=36 or months=48;
OUTPUT
cust_name fd_amount
priyanka 300000
prasun 200000
shriram 400000
11.To display the details about all the FDs whose rate of interest is
not in the range 6% to 7%
select * from workers where int_rate>=6.00 and int_rate<=7.00;
OUTPUT
accno cust_name fd_amount months int_rate fd_date
1001 priyanka 300000 36 6 2018-07-01
1002 prasun 200000 48 6.75 2018-03-22
12.To display the details about all the FDs whose customer name
doesn’t contain the character “a”.
select * from workers where cust_name not like "%a%";
OUTPUT
Empty set
13.To update the Interest rate of all the bank Customers from 5.55
to 6.80
OUTPUT
update workers set int_rate=6.80 where int_rate=5.55;
>>PROGRAM 2:
create database store;
use store;
create table items(code int,iname varchar(25),price float,qty
int,company varchar(25),tcode int);
insert into items values(1,"coat",600,5,"modi",101);
insert into items values(2,"boat",1000,10,"das",101);
insert into items values(3,"pen",100,50,"orio",103);
insert into items values(4,"book",25,15,"das",104);
select * from items;
| code | iname | price | qty | company | tcode |
| 1 | coat | 600 | 5 | modi | 101 |
| 2 | boat | 1000 | 10 | das | 101 |
| 3 | pen | 100 | 50 | orio | 103 |
| 4 | book | 25 | 15 | das | 104 |
1.To display the natural join of the tables items and traders.
select * from items natural join traders;
OUTPUT
| tcode | code | iname | price | qty | company | tname | city
|
| 101 | 1 | coat | 600 | 5 | modi | prasun | angul |
| 101 | 2 | boat | 1000 | 10 | das | prasun | angul |
| 103 | 3 | pen | 100 | 50 | orio | shriram | halo |
| 104 | 4 | book | 25 | 15 | das | nayo | hyderabad |
4.To display the Item name and Trader name of all the items that
are either from HALO or ANGUL
select iname,tname from items natural join traders where city
in("halo","angul");
OUTPUT
| iname | tname |
| coat | prasun |
| boat | prasun |
| pen | shriram |
9.To display the details about all the items whose avg price is in the
range 200 and 1000.
select * from items having avg(price)>=200 and avg(price)<=1000;
OUTPUT
| code | iname | price | qty | company | tcode |
>>PROGRAM 3:
select * from worker;
| wno | name | doj | dob | gender | dcode |
| 1001 | prasun | 2013-09-02 | 1991-09-01 | male | d01 |
| 1002 | shriram | 2015-07-02 | 1991-09-04 | male | d02 |
| 1003 | priyanka | 2016-08-12 | 1989-10-10 | female | d03 |
| 1005 | nayo | 2014-01-17 | 1984-10-19 | female | d01 |
2)To display the names and date of joining of all the workers in
Kolkata.
select name doj from worker natural join dept where city like
"kolkata";
OUTPUT
| doj |
| priyanka |
7)To display the details about all the workers whose Wno is either
1003 , 1005 or 1007
select * from worker where wno in (1003,1005,1007);
OUTPUT
| wno | name | doj | dob | gender | dcode |
| 1003 | priyanka | 2016-08-12 | 1989-10-10 | female | d03 |
| 1005 | nayo | 2014-01-17 | 1984-10-19 | female | d01 |
OUTPUT
Dcode wno name doj dob gender department city
d03 1003 priyanka 2016-08-12 1989-10-10 female finance kolkata
>>PROGRAM 4:
select * from hospital;
| pno | name | age | dept | doa | charges | sex |
| 1 | prasun | 65 | surgery | 2018-02-23 | 600 | m |
| 2 | shriram | 24 | ent | 2019-01-01 | 400 | f |
| 3 | nayo | 45 | cardiology | 2018-12-19 | 400 | f |
| 4 | ali | 14 | ortho | 2018-10-01 | 600 | m |
1.To show all the information about the patients of the cardiology
department.
select * from hospital where dept="cardiology";
OUTPUT
| pno | name | age | dept | doa | charges | sex |
| 3 | nayo | 45 | cardiology | 2018-12-19 | 400 | f |
2.To list the names of female patients who are either in the
orthopaedic or surgery department.
select name from hospital where sex="f" and (dept="ortho" or
dept="surgery");
OUTPUT
Empty set
3.To display various departments in the hospital.
select distinct dept from hospital;
OUTPUT
| dept |
| surgery |
| ent |
| cardiology |
| ortho |
6.To display the details of all the patients who was admitted in the
year 2019.
select * from hospital where year(doa)=2019;
OUTPUT
| pno | name | age | dept | doa | charges | sex |
| 2 | shriram | 24 | ent | 2019-01-01 | 400 | f |
7.To display the details about all the patients in the reverse
alphabetical order of their names.
select * from hospital order by name desc;
OUTPUT
| pno | name | age | dept | doa | charges | sex |
| 2 | shriram | 24 | ent | 2019-01-01 | 400 | f |
| 1 | prasun | 65 | surgery | 2018-02-23 | 600 | m |
| 3 | nayo | 45 | cardiology | 2018-12-19 | 400 | f |
| 4 | ali | 14 | ortho | 2018-10-01 | 600 | m |
10.To display the names of the patients who are charged in the
range 300 and 400
select name from hospital where charges between 300 and 400;
OUTPUT
| name |
| shriram |
| nayo |
11.To display the number of patients who are aged above 30.
select count(*) from hospital where age>30;
OUTPUT
| count(*) |
| 2|
>>PROGRAM 5:
select * from club;
| coach_id | name | age | sports | doa | pay | sex |
| 1 | prasun | 35 | golf | 1996-03-27 | 1000 | m |
| 2 | nayo | 34 | karate | 1998-01-20 | 1200 | f |
| 3 | shriram | 34 | squash | 1999-02-19 | 2000 | m |
| 4 | priyanka | 30 | football | 1998-01-01 | 1500 | f |
| 5 | pratibha | 35 | golf | 1998-01-12 | 3000 | f |
1.To show all information about the golf coaches in the Club.
select * from club where sports="golf";
OUTPUT
| coach_id | name | age | sports | doa | pay | sex
| 1 | prasun | 35 | golf | 1996-03-27 | 1000 | m |
| 5 | pratibha | 35 | golf | 1998-01-12 | 3000 | f |
2.To list the names of all coaches with their date of appointment in
descending order.
select name from club order by doa desc;
OUTPUT
| name |
| shriram |
| nayo |
| pratibha |
| priyanka |
| prasun |
6.To display the details about the female coaches in the club.
select * from club where sex="f";
OUTPUT
| coach_id | name | age | sports | doa | pay | sex |
| 2 | nayo | 34 | karate | 1998-01-20 | 1260 | f |
| 4 | priyanka | 30 | football | 1998-01-01 | 1575 | f |
| 5 | pratibha | 35 | golf | 1998-01-12 | 3150 | f |
7. To display the coachnames, sports , pay and date of_app of all
the coaches whose name ends with “a”.
select name,sports,pay,doa from club where name like "%a";
OUTPUT
| name | sports | pay | doa |
| priyanka | football | 1575 | 1998-01-01 |
| pratibha | golf | 3150 | 1998-01-12 |
8.To display the coachname, sports ,age and pay of all the coaches
whose pay is in the range 2000-2500
select name,sports,age,pay from club where pay>=1000 and
pay<=2000;
OUTPUT
| name | sports | age | pay |
9.To display the details about all the coaches who are above 30 in
age and coach a sport starting with the letter “g”.
select * from club where age>30 and sports like "g%";
OUTPUT
| coach_id | name | age | sports | doa | pay | sex |
| 1 | prasun | 35 | golf | 1996-03-27 | 1050 | m |
| 5 | pratibha | 35 | golf | 1998-01-12 | 3150 | f |
11. To display the average Pay given for a coach for every sports
activity.
select avg(pay) from club group by sports;
OUTPUT
| avg(pay) |
| 1575.0000 |
| 2100.0000 |
| 1260.0000 |
| 2100.0000 |
12. To display the details about all the male coaches who joined
after 15th February 1998.
select * from club where sex="m" and doa>"1998-02-15";
OUTPUT
| coach_id | name | age | sports | doa | pay | sex |
| 3 | shriram | 34 | squash | 1999-02-19 | 2100 | m |
13. To display the coach id , names and age of all the coaches who
coach neither Swimming nor golf
select coach_id,name,age from club where sports!="swimming" and
sports!="golf";
OUTPUT
| coach_id | name | age |
| 2 | nayo | 34 |
| 3 | shriram | 34 |
| 4 | priyanka | 30 |
14.To display the names of all the sports in the club which have
more than 2 coaches.
select sports from club group by sports having count(*)>1;
OUTPUT
| sports |
| golf |
15.To display the total salary given for male and female coaches in
the club.
select sum(pay) from club group by sex;
OUTPUT
| sum(pay) |
| 5985 |
| 3150 |
PROJECT FILE
For
AISSCE 2025 Examination
[As a part of the Computer Science Course (083)]
SUBMITTED BY
PRIYANKA LATH
………………………… ……………………………..
Signature of External Examiner Signature of Internal Examiner
CONTENT
1. Introduction
2. Gratitude
3. System description
4. Java coding
5. Output frames
6. Conclusion
Bibliography
INTRODUCTION
GRATITUDE
I have taken effort in this project. However, it would not
have been possible without the kind support of many
individuals.
I would like to extend my gratitude total of them.
I thank the Almighty for providing me with everything
that I required in completing this project. I am highly
indebted to the teacher in charge Mrs.Deepa Sreehari
for her guidance and constant supervision as well as for
providing necessary information regarding this project
and also for her support in completing this project.
I would like to express my gratitude towards my
parents for their kind cooperation and encouragement
which helped me in the completion of this project.
My thanks and appreciation also go to all those who
have helped me to develop this project and to those
who have willingly helped with whatever they can.
SYSTEM
DESCRIPTION
USER
ITEMS
PURCHASE
PYTHON CODE
print("***************************")
import mysql.connector
import random
con=
mysql.connector.connect(host="localhost",user="root",password="jirs",charset="utf8",data
base="shop")
cur=con.cursor()
def addproduct():
ch="yes"
while ch=="yes":
icode=random.randint(100,999)
iname=input("ENTER THE PRODUCT NAME:")
price=int(input("ENTER THE PRICE OF THE PRODUCT:"))
qty=int(input("ENTER THE QUANTITY OF THE PRODUCT:"))
q="insert into items values(%s,%s,%s,%s);"
t=(icode,iname,price,qty)
cur.execute(q,t)
con.commit()
print("YOUR PRODUCT CODE IS:",icode)
print("YOUR PRODUCT IS ADDED SUCCESFULLY")
ch=input("Enter your choice(yes/no)")
def deleteproduct( ):
ch="yes"
while ch=="yes":
icode=int(input("ENTER THE CODE OF THE PRODUCT:"))
d="delete from items where icode=%s;"
t=(icode,)
cur.execute(d,t)
con.commit()
ch=input("Enter your choice(yes/no)")
def viewproducts():
icode=int(input("ENTER THE CODE OF THE PRODUCT:"))
v="select * from items where icode=%s;"
t=(icode,)
cur.execute(v,t)
for i in cur:
print(i)
def update1():
icode=int(input("ENTER THE CODE OF THE PRODUCT:"))
iname=input("ENTER THE PRODUCT NAME:")
dsc=input("ENTER THE PRODUCT TYPE:")
price=int(input("ENTER THE PRICE OF THE PRODUCT:"))
qty=int(input("ENTER THE QUANTITY OF THE PRODUCT:"))
d="update items set iname = %s,dsc=%s,price=%s,qty=%s where icode=%s;"
t=( iname,dsc,price,qty,icode)
cur.execute(d,t)
con.commit()
def first_option():
choice='yes'
while choice=="yes":
print("""
1. ADD PRODUCT
2. VIEW PRODUCT
3. UPDATE PRODUCT
4. DELETE PRODUCT
5. EXIT""")
option=int(input("Enter your option "))
if option==1:
addproduct()
elif option==2:
viewproducts()
elif option==3:
update1()
elif option==4:
deleteproduct( )
elif option==5:
print("------EXIT------")
else:
print("Wrong input ")
choice=input('do you want to continue:yes/no')
def viewpurchase():
v="select * from purchase;"
cur.execute(v)
for i in cur:
print(i)
def updatepurchase():
ch=input("enter the product name that you want to update")
qt=int(input("ENTER THE QUANTITY that you want to update"))
d="update purchase set qt=%s where pdname=%s ;"
t=(qt,ch)
cur.execute(d,t)
con.commit()
def purchase():
print("""
1.pen(rs10 per pc)
2.pencil(rs12 per pc)
3.eraser(rs15 per pc)
4.ruler(rs16 per pc)
5.sharpener(rs20 per pc)
"""
)
ch=input("enter the product name that you want to buy:")
qt=int(input("ENTER THE QUANTITY:"))
if ch== "pen":
icode=198
s="insert into purchase values (%s,%s,%s);"
t=(qt,ch,icode)
cur.execute(s,t)
con.commit()
print("---------------------YOUR ITEM IS ADDED TO CART----------------------")
elif ch== "pencil":
icode=457
s="insert into purchase values (%s,%s,%s);"
t=(qt,ch,icode)
cur.execute(s,t)
con.commit()
print("---------------------YOUR ITEM IS ADDED TO CART----------------------")
elif ch== "eraser":
icode=909
s="insert into purchase values (%s,%s,%s);"
t=(qt,ch,icode)
cur.execute(s,t)
con.commit()
print("---------------------YOUR ITEM IS ADDED TO CART----------------------")
elif ch== "ruler":
icode=111
s="insert into purchase values (%s,%s,%s);"
t=(qt,ch,icode)
cur.execute(s,t)
con.commit()
print("---------------------YOUR ITEM IS ADDED TO CART----------------------")
elif ch== "sharpener":
icode=636
s="insert into purchase values (%s,%s,%s);"
t=(qt,ch,icode)
cur.execute(s,t)
con.commit()
print("---------------------YOUR ITEM IS ADDED TO CART----------------------")
def bill():
a=0
b=0
s="select * from purchase natural join items;"
cur.execute(s)
for i in cur:
c=list(i)
w=c[1]
z=c[5]
a+=w
b+=z
f=a*b
print("total price",a,"total qty",b,"total amt",f)
while True:
print("---Welcome--- ")
print("Paymemt methods are (cash,net banking,card)")
name= input('Enter the name of customer: ')
payment= input('Enter the mode of payment: ')
GST= (18/100)*f
if payment=="card":
discount= (5/100)*f
elif payment=="netbanking":
discount= (10/100)*f
elif payment=="cash":
discount= (7/100)*f
total_price=f+GST -discount
print("---------------------------------------------------------------
Invoice-------------------------------------------------------------------")
print("Name of the customer is:",name)
print("Mode of payment is:",payment)
if payment=="card":
print("You got",5, "% discount")
elif payment=="netbanking":
print("You got",10, "% discount")
elif payment=="cash":
print("You got",7, "% discount")
print("Discount is ₹", discount)
print("Total without GST is ₹:",f)
print("GST is ₹:",GST)
print("Total price is ₹",total_price)
print("########THANK YOU FOR PURCHASING FROM OUR SHOP HAVE A NICE DAY
AHEAD AND COME AGAIN########")
break
def second_option():
choice='yes'
while choice=="yes":
print("""
1. PURCHASE
2. VIEW PURCHASE
3. UPDATE PURCHASE
4. BILL
5 . EXIT""")
option=int(input("Enter your option "))
if option==1:
purchase()
elif option==2:
viewpurchase()
elif option==3:
updatepurchase()
elif option==4:
bill()
elif option==5:
print("------EXIT------")
else:
print("Wrong input ")
choice=input('do you want to continue:yes/no')
if choice == "no":
bill()
def logiin():
username = input("Enter your username: ")
password = input("Enter your password: ")
cur.execute("SELECT * FROM users WHERE username = %s AND password = %s",
(username, password))
user = cur.fetchone()
if user:
print(f"Login successful! Welcome {username}.")
second_option()
else:
print("Invalid username or password please try again")
def signin():
username = input("ENTER THE USERNAME: ")
password = input("ENTER THE PASSWORD: ")
t=(username, password)
q="INSERT INTO users VALUES (%s, %s);"
cur.execute(q,t)
con.commit()
print("User created successfully!")
logiin()
OUTPUT FRAMES
***************************
--------- WELCOME TO STORE MANAGEMENT---------
1.ADMIN
2.USER
ENTER YOUR CHOICE2
1.SIGNIN
2.LOGIN
enter your choice1
ENTER THE USERNAME: prasun
ENTER THE PASSWORD: prasun
User created successfully!
Enter your username: prasun
Enter your password: prasun
Login successful! Welcome prasun.
1. PURCHASE
2. VIEW PURCHASE
3. UPDATE PURCHASE
4. BILL
5 . EXIT
Enter your option 1
1.pen(rs10 per pc)
2.pencil(rs12 per pc)
3.eraser(rs15 per pc)
4.ruler(rs16 per pc)
5.sharpener(rs20 per pc)
CONCLUSION
python has significant advantages not only as a
commercial language but also as a teaching language.
It allows students to learn object-oriented programming
without exposing them to the complexity of C++.
It provides the kind of rigorous compile-time error
checking typically associated with Pascal. This was an
effort to develop a simple online shopping program
which can be useful for those people who wish to
purchase the shoe the find in an online shopping site
easily, efficiently with just a few steps in a matter of
few minutes.
BIBLIOGRAPHY
1. Computer science textbook for
class XII and XI
2. Computer science teacher
Mrs.Deepa Sreehari
3. https://
pythontrends.wordpress.com/wp-
content/uploads/2019/05/holiday-
homework-class-xii-cs-2019-20.pdf