We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 45
AISSCE-2023-24
PRACTICAL FILE
COMPUTER SCIENCE (083)Certificate
‘This is to certify that
student of Class XII Science / Commerce has successfully completed their computer
Science (New-083) Practical File.
Internal Examiner External Examiner
Principal
Page2 of 45PRACTICAL FILE- COMPUTER SCIENCE (083)
LIST OF PRACTICALS (2023-24)
CLASS-XII
Write a program to check a number whether
it is palindrome or not.
‘Submission
Date
Teacher's |
Sign
Write a program to display ASCII code of a
character and vice versa.
Program make a simple calculator.
Example of Global and Local variables in
function
Python program to count the number of
vowels, consonants, digits and special
characters in a string
Python Program to add marks and calculate
the grade of a student
Generating a List of numbers Using For Loop
Write a program to read a text file line by line
and display each word separated by ‘#".
Read a text file and display the number of
vowels/ consonants/ uppercase/ lowercase
characters and other than character and digit
in the file.
Write a Python code to find the size of the file
in bytes, the number of lines, and number of
words and no. of character.
Create a binary file with the name and roll
number. Search for a given roll number and
display the name, if not found display
appropriate message.
Page 3 of a52 Create a binary file with roll number, name
and marks. Input a roll number and update
details. Create a binary file with roll number,
name and marks. Input a roll number and
update details.
13 # Write a program to perform read and write
operation onto a student.csv file having fields
as roll number, name, stream and
percentage.
14 Write a program to create a library in python
and import it in a program.
15 Take a sample of ten phishing e-mails (or any
text file) and find the most commonly
occurring word(s).
16 Write a python program to implement a stack
using a list data-structure.
17 Write a program to implement a queue using
a list data structure.
18 SQL Queries
19 Write a program to connect Python with
MySQL using database connectivity and
perform the following operations on data in
database: Fetch, Update and delete the data.
PRAFULLA KUMAR GOUDA SIGNATURE OF EXTERNAL EXAMINER
PGT (COMPUTER SCIENCE)
INTERNAL EXAMINER
Page a of 45Fractical No-t
# Write a program to check a number whether it is palindrome or not.
SOURCE CODE:
num=int(input("Enter a number : "))
n=num
res=0
while num>0:
rem=num%10
res=remt+res*10
num=num//10
if res==n:
print("Number is Palindrome")
else
print("Number is not Palindrome")
Output -
Enter a number : 6556
Number is Palindrome
Page 5 of 45Practical No-2
# Write a program to display ASCII code of a character and vice versa.
var=True
while var:
choice=int(input("Press-1 to find the ordinal value of a character \nPress-2
to find a character of a value\n"))
if choice==1:
ch=input("Enter a character : ")
print(ord(ch))
elif choice==2:
valzint(input("Enter an integer value: "))
print(chr(val))
else:
print("You entered wrong choice")
print("Do you want to continue? Y/N")
option=input()
if option=='y' or option
var=True
else:
var=False
Outpu'
Press-1 to find the ordinal value of a character
Press-2 to find a character of a value
Page 6 of 45enter a character. a
97
Do you want to continue? Y/N
¥
Press-1 to find the ordinal value of a character
Press-2 to find a character of a value
2
Enter an integer value: 65
A
Do you want to continue? Y/N
Page 7 of 45# Program make a simple calculator
# This function subtracts two numbers
def subtract(x, y)
returnx-y
# This function multiplies two numbers
def multiply(x, y):
returnx *y
# This function divides two numbers
def divide(x, y)
returnx/y
print("'Select operation.")
print("1.Add")
print("2.Subtract")
print("3.Multiply")
print("4.Divide")
while True:
# take input from the user
choice = input("Enter choice(1/2/3/4): ")
# check if choice is one of the four options
if choice in ('1', '2', '3', '4')
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
if choice == '1':
Page 8 of 45print(num1, "+", num2, "=", add(num1, num2))
elif choice =
print(num1, "-", num2, "=", subtract(num1, num2)}
elif choice =
print(num1, "*", num2, "=", multiply(num1, num2))
elif choice == '4'
print(num1, "/", num2, "=", divide(num1, num2))
# check if user wants another calculation
# break the while loop if answer is no
next_calculation = input("Let's do next calculation? (yes/no): ")
if next_calculation == "no"
break
else:
print("Invalid Input")
Output -
Select operation.
1.Add
2.Subtract
3.Multiply
4.Divide
Enter choice(1/2/3/4): 3
Enter first number: 15
Enter second number: 14
15.0 * 14.0 = 210.0
Let's do next calculation? (yes/no): no
Page of a5def display():
global x
y="local"
x=x*2
print(x)
print(y)
display()
Output -
global global
local
Page 10 of 45str = input(“Enter the string : “)
vowels = 0
digits = 0
consonants =0
spaces = 0
symbols = 0
str = str.lower()
for iin range(9, len(str)):
if(str[i] == ‘a’or str[i] == ‘e’ or str[i] == ‘i’
or str[i
‘o’ or str[i] == ‘u’):
vowels = vowels + 1
elif((str{i] >= ‘a’and str[i] <=‘z’)):
consonants = consonants + 1
elif( str{i] >=
digits = digits +1
elif (str[i] ==" ‘)
spaces = spaces + 1
else:
symbols = symbols +1
print(“Vowels: “, vowels);
print(“Consonants: “, consonants);
print(“Digits: “, digits);
Page 11 of 45print, white spaces: , spaces),
print(“Symbols : “, symbols);
Output -
Enter the string : 123 hello world $%&45,
Volwels: 3
Consontants: 7
Digits: 5
White spaces: 3
symbols: 3
Page 12 of 5Practical No-6
# Python Program to add marks and calculate the grade of a student
total=int(input("Enter the maximum mark of a subject: "))
sub1=int(input("Enter marks of the first subject: "))
sub2=int(input("Enter marks of the second subject: "))
sub3=int(input("Enter marks of the third subject: "))
sub4=int(input("Enter marks of the fourth subject: "))
subSzint(input("Enter marks of the fifth subject: "))
average=(sub1+sub2+sub3+sub4+sub5)/S
print("Average is ",average)
percentage=(average/total)*100
print("According to the percentage, ")
if percentage >= 90
print("Grade: A")
elif percentage >= 80 and percentage < 90:
print("Grade: B")
elif percentage >= 70 and percentage < 80:
print("Grade: C")
elif percentage >= 60 and percentage < 70:
print("Grade: D")
else
print("Grade: E")
Page 13 of a5Enter the maximum mark of a subject: 10
Enter marks of the first subject: 8
Enter marks of the second subject: 7
Enter marks of the third subject: 9
Enter marks of the fourth subject: 6
Enter marks of the fifth subject: 3
Average is 7.6
According to the percentage,
Grade: C
Page 14 of 45Fractical No-/
# Generating a List of numbers Using For Loop
import random
randomlist = (]
for i in range(0,5):
= random.randint(1,30)
randomlist.append(n)
print(randomlist)
Output
[10, 5, 21, 1, 17]
Page 15 of a5Practical No-8
# Write a program to read a text file line by line and display each word
separated by '#'.
filein = open("Mydoc.txt",'r')
for line in filein:
word= line .split()
for win word:
print(w + '#,end =")
print()
filein.close()
OR
fin=open("D:\\python programs\\Book.txt",'r')
in.readlines( )
for iin range(len(L1)):
L=L1[i].split()
for jin L:
print(s)
fin.close( )
Output -
Text in file
hello how are you?
python is case-sensitive language.
Output in python shell
hellofhow#are#you?#pythontis#tcase-sensitive#language.#
Page 16 of 45count_vow = 0
count_con =0
count_low =0
count_up =0
count_digit = 0
count_other = 0
print(line)
for ch in line:
if ch.isupper():
count_up +=1
if ch.islower():
count_low += 1
if ch in ‘aeiouAEIOU':
count_vow += 1
if ch.isalpha():
count_con += 1
if ch.isdigit():
count_digit += 1
if not ch.isalnum() and ch !="' and ch !="\n"
count_other += 1
Page 17 of 45wer
a Severe
print("Upper Case: ",count_up)
print("Lower Case: ",count_low)
print("other than letters and digit: ",count_other)
filein.close()
Page 18 of 45Practical No-9
# Remove all the lines that contain the character ‘a’ in a file and write it to
another file
f1 = open("Mydoc.txt")
£2 = open("copyMydoc.txt","w"
for line in f1:
if'a' not in line:
f2.write(line)
print('## File Copied Successfully! ##')
f1.close()
f2.close()
£2 = open("copyMydoc.txt","r")
print(f2.read())
Page 19 of a5Practical No-10
# Write a Python code to find the size of the file in bytes, the number of lines,
number of words and no. of character.
import os
lines = 0
words = 0
letters = 0
filesize = 0
for line in open("Mydoc.txt"):
lines += 1
letters += len(line)
# get the size of file
filesize = os.path.getsize("Mydoc.txt")
# A flag that signals the location outside the word.
pos = ‘out’
for letter in line:
if letter !='' and pos == 'out':
words += 1
pos = ‘in’
elif letter =='':
pos = ‘out!
print("Size of File is", filesize, bytes’)
print("Lines:", lines)
print("Words:", words)
print("Letters:", letters)
Page 20 of 45number and display the name, if not found display appropriate message.
import pickle
def Writerecord(sroll,sname):
with open ('StudentRecord1.dat’,'ab’) as Myfile:
srecord={"SROLL":sroll,"SNAME":sname}
pickle.dump(srecord,Myfile)
def Readrecord():
with open (‘StudentRecord1.dat’,'rb') as Myfile:
print("\n-------I DISPALY STUDENTS DETAILS----
print("\nRoll No.","','Name’, \t',end=
print()
while True:
try:
rec=pickle.load(Myfile)
print(' ',rec['SROLL'],\t " ,rec['SNAME'])
except EOFError:
break
def Input():
n=int(input("How many records you want to create :"))
for ctr in range(n):
sroll=int(input("Enter Roll No: "))
Page 21 of 45sname=input("Enter Name: ")
Writerecord(sroll,sname)
def SearchRecord(roll):
with open ('StudentRecord1.dat’, 'rb') as Myfile:
while True:
try:
rec=pickle.load(Myfile)
if rec[‘SROLL']==roll:
print("Roll NO:",rec['SROLL'])
print("Name:",rec['SNAME"])
except EOFError:
print("Record not find.
print("Try Agaii
break
def main()
while True:
print("\nYour Choices are: ')
print('1.Insert Records’)
print('2.Dispaly Records’)
print('3.Search Records (By Roll No)')
Page 22 of a5print('0.Exit (Enter 0 to exit)')
ch=int(input('Enter Your Choice: '))
if ch
Input()
elif ch==2:
Readrecord()
elif ch==3:
r=int(input("Enter a Rolino to be Search: "))
SearchRecord(r)
else:
break
main()
Page 23 of 45def Writerecord(sroll,sname,sperc,sremark):
with open ('StudentRecord.dat’,'ab') as Myfile:
srecord={"SROLL":sroll,"SNAME":sname,"SPERC":sperc,
"SREMARKS":sremark}
pickle.dump(srecord,Myfile)
def Readrecord():
with open ('StudentRecord.dat’,'rb') as Myfile:
print("\n-------DISPALY STUDENTS DETAILS---
print("\nRoll No.","','Name’,'\t',end=
print('Percetage',' ','Remarks')
while True:
try:
rec=pickle.load(Myfile)
print(' ',rec['SROLL'],"\t ' ,rec['SNAME'],'\t ‘end=")
print(rec['SPERC’],'\t_',rec['SREMARKS'])
except EOFError:
break
def Input():
n=int(input("How many records you want to create :"))
for ctr in range(n):
sroll=int(input("Enter Roll No: "))
Page 24 of 45sname=input("Enter Name: ")
sperc=float(input("Enter Percentage: "))
sremark=input("Enter Remark: ")
Writerecord(sroll,sname,sperc,sremark)
def Modify(roll):
with open ('StudentRecord.dat','rb') as Myfile:
newRecord=[]
while True:
try:
rec=pickle.load(Myfile)
newRecord.append(rec)
except EOFError:
break
found=1
for i in range(len(newRecord)):
if newRecord[i]['SROLL']==roll:
name=input("Enter Name: ")
perc=float(input("Enter Percentage: "))
remark=input("Enter Remark: ")
newRecord[i]['SNAME']J=name
newRecord{i]['SPERC'}=perc
newRecord{[i]['SREMARKS']=remark
found =1
else:
Page 25 of 45found=0
if found==0:
print("Record not found")
with open ('StudentRecord.dat’,'wb') as Myfile:
for j in newRecord:
pickle.dump(j,Myfile)
def main()
while True:
print("\nYour Choices are: ')
print('1.Insert Records’)
print('2.Dispaly Records’)
print('3.Update Records')
print('0.Exit (Enter 0 to exit)')
ch=int(input('Enter Your Choice: '))
if ch=:
Input()
elif ch==2:
Readrecord()
elif ch==3:
r=int(input("Enter a Rolino to be update: "))
Modify(r)
else:
break
main()
Page 26 of a5import csv
with open('Student_Details.csv','w'newline=") as csvf:
)
writecsv=csv.writer(csvf,delimite
choice='y'
while choice.lower()=='y':
rlsint(input("Enter Roll No.: "))
n=input("Enter Name: ")
p=float(input("Enter Percentage: "))
rsinput("Enter Remarks: ")
writecsv.writerow([rl,n,p,r])
print(" Data saved in Student Details file..")
choice=input("Want add more record(y/n)..
with open('Student_Details.csv','r',newline=") as fileobject:
readcsv=csv.reader(fileobject)
for iin readcsv:
print(i)
Page 27 of a5Ks Sse TT. NA
Practical No-14
# Write a program to create a library in python and import it in a program.
#Let's create a package named Mypackage, using the following steps:
#e Create a new folder named NewApp in D drive (D:\NewApp)
#e Inside NewApp, create a subfolder with the name 'Mypackage’.
#* Create an empty __init__py file in the Mypackage folder
#* Create modules Area.py and Calculator.py in Mypackage folder with
following code
# Area.py Module
import math
def rectangle(s1,s2):
area = s1*s2
return area
def circle(r):
area= math.pi*r*r
return area
def square(s1):
area = s1*s1
return area
def triangle(s1,s2):
area=0.5*s1*s2
Page 28 of 45return area
# Calculator.py Module
def sum(n1,n2):
s=n1+n2
return s
def sub(n4,n2):
n1-n2
return r
def mult(n1,n2):
m=ni*ni
return m
def div(n1,n2)
d=n1/n2
return d
# main() function
from Mypackage import Area
from Mypackage import Calculator
def main()
loat(input("Enter Radius: "))
area =Area.circle(r)
print(""The Area of Circle is:",area)
s1 = float(input("Enter side1 of rectangle: "))
"))
s2 = float(input("Enter side2 of rectangle:
area = Area.rectangle(s1,s2)
Page 29 of a5print("The Area of Rectangle is: area)
s1 = float(input("Enter side1 of triangle: "))
52 = float(input("Enter side2 of triangle: "))
area = Area.triangle(s1,s2)
print("The Area of TriRectangle is:",area)
5 = float(input("Enter side of square: "))
area =Area.square(s)
print("The Area of square is:",area)
num1 = float(input("\nEnter First number :"))
num? = float(input("\nEnter second number :"))
print("\nThe Sum is : ",Calculator.sum(num1,num2))
print("\nThe Multiplication is : ",Calculator.mult(num1,num2))
print("\nThe sub is : ",Calculator.sub(num1,num2))
print("\nThe Division is : ",Calculator.div(num1,num2))
main()
Page 30 of 45fin = open(‘email.txt','r')
a= fin.read()
d={}
L=a.lower().split()
for word in L:
word = word.replace(".","")
word = word.replace(",","")
word = word.replace(":",")
word = word.replace("\",")
word = word.replace("!","")
word = word.replace("&","")
word = word.replace("*"
for k in L:
key=k
if key not ind:
count=L.count(key)
d{key]=count
n= int(input("How many most common words to print: "))
print("\nOK. The {} most common words are as follows\n".format(n))
word_counter = collections.Counter(d)
Page 31 of 45,=——— ee
—— eee eT
print(word, ":", count)
fin.close()
#Driver Code
def main()
Read_Email_File()
main()
Page 32 of 45def isempty(stk):
q:
return True
if stk=:
else:
return False
def push(stk,item):
stk.append{item)
top=len(stk)-1
def pop(stk):
if isempty(stk):
return "underflow"
else:
item=stk.pop()
if len(stk)==0:
top=None
else:
top=len(stk)-1
return item
def peek(stk):
Page 33 of a5,TE
return underflow"
else:
top=len(stk)-1
return stk{top]
def display(stk):
if isempty(stk):
print('stack is empty’)
else:
top=len(stk)-1
print(stk[top],'<-top')
for i in range(top-1,-1,-1):
print(stk{i])
#Driver Code
def main()
stk=[]
top=None
while True:
print("stack operation
L.push
2.pop
Page 34 of 45— 9 Ses ee TT.
3.peek
A.display
S.exit"")
choice=int (input(‘enter choice:'))
a
if choice:
item=int(input(‘enter item:’))
push(stk,item)
elif choice==2:
item=pop(stk)
if item=="underflow":
print('stack is underflow’)
else:
print(‘poped')
elif choice==3:
item=peek(stk)
if item=="underflow":
print('stack is underflow’)
else:
print('top most item is:',item)
elif choice==4:
display(stk)
elif choice
break
else:
print(‘invalid’)
exit()
main()
Page 35 of 45# Write a program to implement a queue using a list data structure.
# Function to check Queue is empty or not
def isEmpty(qlst):
if len(qLst)==0:
return 1
else
return O
# Function to add elements in Queue
def Enqueue(qLst,val)
qlst.append(val)
if len(qLst}
front=rear=0
else:
rear=len(qLst)-1
# Function to Delete elements in Queue
def Dqueue(qLst)
if isEmpty(qLst):
return "UnderFlow"
else
Page 36 of 45
Read without ads. Te ee turdRead without ads.
val = qLst.pop(0)
‘0:
if len(qlst)=
front=rear=None
return val
# Function to Display top element of Queue
def Peek(qLst):
if isEempty(qLst):
return "UnderFlow"
else:
front=0
return qlstffront]
# Function to Display elements of Queue
def Display(qLst):
if isempty(qLst):
print("No Item to Dispay in Queue...
else:
tp = len(qLst)-1
print("[FRONT]",end=" ')
front =0
|= front
rear = len(qlst)-1
while(i<=rear):
Page 37 of 45
Urduit=1
print()
# Driver function
def main()
gList = []
front = rear = 0
while True:
print()
print("##### QUEUE OPERATION ######")
print("1. ENQUEUE ")
print("2. DEQUEUE ")
print("3. PEEK ")
print("4. DISPLAY ")
print("0. EXIT")
choice = int(input("Enter Your Choice: "))
if choice == 1:
ele = int(input("Enter element to insert")
Enqueue(qList,ele)
elif choice =:
val = Dqueue(qList)
if val == "UnderFlow":
Page 38 of 45print("Queue is Empty")
else:
print("\n Deleted Element was : ",val)
elif choice==3:
val = Peek(qList)
if val == "UnderFlow"
print("Queue is Empty")
else:
print("Item at Front: ",val)
elif choice==:
Display(qList)
elif choice==0:
print("Good Luck...
break
main()
Page 39 of 45Practical No-18
Create a table EMPLOYEE with constraints
SOLUTION
Step-1 Create a database:
CREATE DATABASE Bank;
Step-2 Display the databases
SHOW DATABASES;
Step-3: Enter into database
Use Bank;
Step-4: Create the table EMPLOYEE
create table Employee(Ecode int primary key,Ename varchar(20) NOT NULL,
Dept varchar(15),City varchar(15), sex char(1), DOB date, Salary float(12,2));
Insert data into the table
SOLUTION
insert into Employee values(1001,"Atul","Production","Vadodara","M","1992-
10-23",23000.50);
Query OK, 1 row affected (0.11 sec)
Note: Insert more rows as per above insert command.
Add a new column in a table.
SOLUTION
ALTER TABLE EMPLOYEE ADD address varchar(50);
Page 40 of a5Change the data-type and size of an existing column.
SOLUTION
ALTER TABLE EMPLOYEE MODIFY city char(30);
Write SQL queries using SELECT, FROM, WHERE clause based on
EMPLOYEE table.
1. List the name of female employees in EMPLOYEE table.
Solution:-
SELECT Ename FROM EMPLOYEE WHERE sex="’
2. Display the name and department of those employees who work in surat
and salary is greater than 25000.
Solution:-
SELECT Ename, Dept FROM EMPLOYEE WHERE city=’surat’ and salary > 25000;
3. Display the name of those female employees who work in Mumbai.
Solution:-
SELECT Ename FROM EMPLOYEE WHERE sex=’
and city=’Mumbai’;
4. Display the name of those employees whose department is marketing or
RND.
Solution:-
SELECT Ename FROM EMPLOYEE WHERE Dept=’marketing’ OR Dept=’RND’
5. List the name of employees who are not males.
Solution:-
SELECT Ename, Sex FROM EMPLOYEE WHERE sex!=’M''
Page 41 of a5,Queries using DISTINCT, BETWEEN, IN, LIKE, IS NULL, ORDER BY,
GROUP BY, HAVING
A. Display the name of departments. Each department should be displayed
once.
SOLUTION
SELECT DISTINCT(Dept) FROM EMPLOYEE;
B. Find the name and salary of those employees whose salary is between
35000 and 40000.
SOLUTION
SELECT Ename, salary FROM EMPLOYEE WHERE salary BETWEEN 35000 and
40000;
C. Find the name of those employees who live in guwahati, surat or jaipur city.
SOLUTION
SELECT Ename, city FROM EMPLOYEE WHERE city IN(‘Guwahati’,’Surat’,Jaipur’);
D. Display the name of those employees whose name starts with ‘M’.
SOLUTION
SELECT Ename FROM EMPLOYEE WHERE Ename LIKE ‘M%’;
E. List the name of employees not assigned to any department.
SOLUTION
SELECT Ename FROM EMPLOYEE WHERE Dept IS NULL;
F. Display the list of employees in descending order of employee code.
SOLUTION
SELECT * FROM EMPLOYEE ORDER BY ecode DESC;
Page 42 of 45G. Find the average salary at each department.
SOLUTION
SELECT Dept, avg(salary) FROM EMPLOYEE group by Dept;
H.Find maximum salary of each department and display the name of that
department which has maximum salary more than 39000.
SOLUTION
SELECT Dept, max(salary) FROM EMPLOYEE group by Dept HAVING
max(salary)>39000;
Queries for Aggregate functions- SUM( ), AVG( ), MIN(), MAX(), COUNT()
a. Find the average salary of the employees in employee table.
Solution:-
SELECT avg(salary) FROM EMPLOYEE;
b. Find the minimum salary of a female employee in EMPLOYEE table.
Solution:
SELECT Ename, min(salary) FROM EMPLOYEE WHERE sex=’F’;
c. Find the maximum salary of a male employee in EMPLOYEE table.
Solution:-
SELECT Ename, max(salary) FROM EMPLOYEE WHERE sex=’
d. Find the total salary of those employees who work in Guwahati city.
Solution:-
SELECT sum(salary) FROM EMPLOYEE WHERE city=’Guwahati’;
e. Find the number of tuples in the EMPLOYEE relation.
Solution:- SELECT count(*) FROM EMPLOYEE
Page 43 of 45Practical No-19
# Write a program to connect Python with MySQL using database connectivity
and perform the following operations on data in database: Fetch, Update and
delete the data.
A. CREATE A TABLE
SOLUTION
import mysql.connector
demodb = mysql.connector.connect(host="localhost", user="root",
passwd="computer", database="EDUCATION")
democursor=demodb.cursor( )
democursor.execute("CREATE TABLE STUDENT (admn_no int primary key,
sname varchar(30), gender char(1), DOB date, stream varchar(15), marks
float(4,2))")
B. INSERT THE DATA
SOLUTION
import mysql.connector
demodb = mysql.connector.connect(host="localhost", user="root",
passwd="computer", database="EDUCATION")
democursor=demodb.cursor( )
democursor.execute("insert into student values (%s, %s, %s, %s, %s, %s)",
(1245, 'Arush', 'M', '2003-10-04', ‘science’, 67.34))
demodb.commit( )
C. FETCH THE DATA
SOLUTION
import mysql.connector
Page 44 of 45demodb = mysq|.connector.connect(host="localhost", user="root",
passwd="computer", database="EDUCATION")
democursor=demodb.cursor( )
democursor.execute("select * from student")
for i in democursor:
print(i)
D. UPDATE THE RECORD
SOLUTION
import mysql.connector
demodb = mysql.connector.connect(host="localhost", user="root",
passwd="computer", database="EDUCATION")
democursor=demodb.cursor( )
democursor.execute("update student set marks=55.68 where admn_no=1356")
demodb.commit( )
E. DELETE THE DATA
SOLUTION
import mysql.connector
demodb = mysql.connector.connect(host="localhost", user="root",
passwd="computer", database="EDUCATION")
democursor=demodb.cursor( )
democursor.execute("delete from student where admn_no=1356")
demodb.commit()
Page 45 of 45