0% found this document useful (0 votes)
31 views16 pages

Practical

Uploaded by

karthi keyan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views16 pages

Practical

Uploaded by

karthi keyan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

1.

AIM- Write
a program to search an element in a list and display the
frequency of element present in list and their location using Linear search

OUTPUT

2. AIM- Write a to
search an element in a list and display the frequency of
element present in list and their location using Binary Search

OUTPUT

PRACTICAL- 4
AIM- Write
a program to input n numbers in tuple and pass it to function to
count how many even and odd numbers are entered

OUTPUT

PRACTICAL- 5
AIM- Write a program to function with key and value, and update value at that key in
dictionary entered by user

OUTPUT

PRACTICAL- 6
AIM- Write a program to pass a string to a function and count how many
vowels present in the string
OUTPUT

PRACTICAL- 7
AIM- Write a program to generator that generates random numbers
between 1 and 6 using user defined function

OUTPUT

PRACTICAL- 8
AIM- Program to implement Queue in Python using List.
OUTPUT
**** QUEUE DEMONSTRATION ******
0. ENQUEUE
1. DEQUEUE
2. PEEK
3. SHOW QUEUE
0. EXIT

Enter your choice :1 Enter Item to Insert :10


**** QUEUE DEMONSTRATION ******
1. ENQUEUE
2. DEQUEUE
3. PEEK
4. SHOW QUEUE
0. EXIT

Enter your choice :1 17


Enter Item to Insert :20
**** QUEUE DEMONSTRATION ******
1. ENQUEUE
2. DEQUEUE
3. PEEK
4. SHOW QUEUE
0. EXIT

Enter your choice :1


Enter Item to Insert :30
**** QUEUE DEMONSTRATION ******
1. ENQUEUE
2. DEQUEUE
3. PEEK
4. SHOW QUEUE
0. EXIT

Enter your choice :4


(Front) 10 ==> 20 ==> 30 ==>
**** QUEUE DEMONSTRATION ******
1. ENQUEUE
2. DEQUEUE
3. PEEK
4. SHOW QUEUE
0. EXIT

Enter your choice :3


Front Item : 10
**** QUEUE DEMONSTRATION ******
1. ENQUEUE
2. DEQUEUE
3. PEEK
4. SHOW QUEUE
0. EXIT

Enter your choice :2 Deleted Item was : 10


**** QUEUE DEMONSTRATION ******
1. ENQUEUE
2. DEQUEUE
3. PEEK
4. SHOW QUEUE
0. EXIT

Enter your choice :4 (Front) 20 ==> 30 ==>


**** QUEUE DEMONSTRATION ****** 18
1. ENQUEUE
2. DEQUEUE
3. PEEK
4. SHOW QUEUE
0. EXIT

Enter your choice :0


Bye

PRACTICAL- 9
AIM- Write a program to implement python string functions

OUTPUT

PRACTICAL- 10
AIM- Write a program to read and display file content line by line with each
word separated by #.

OUTPUT
PRACTICAL- 11
AIM- Write a program to read characters from keyboard one by one, all
lower case letters gets stored inside a file “LOWER”, all uppercase letters
gets stored inside a file “UPPER”, and all other characters get stored inside
“OTHERS”

OUTPUT

PRACTICAL- 12
AIM- Write a program to create a binary file with roll number, name and
marks, input a roll number and update the marks.
OUTPUT

PRACTICAL- 13
AIM- Write a program to create Lpush() and Lpop() function to do push and
pop operation on a stack using a list e.g. take a student information and
push and pop the details
OUTPUT
PRACTICAL- 14
AIM- Write a programto create a student table and insert data. Implement
the following SQL commands on the student table:
ALTER table to add new attributes / modify data type / drop attribute
UPDATE table to modify data ORDER By to display data in ascending / descending
order
DELETE to remove tuple(s) GROUP BY and find the min, max, sum, count and
average

use studentdb; Database changed CREATING TABLE


create table student (roll int not null,
studentname varchar(30) not null,
class char(5) not null,
section char(1) not null,

classstream char(20) not null);

desc student;

INSERTING VALUE
insert into student values
(1, "Akhil", "XII", "A", "Science"),
(2, "Satya", "XII", "C", "Science"),
(3, "Antony", "XII", "D", "Commerce"),
(4, "Vishal", "XII", "E", "Humanities"),
(5, "Deepak", "XII", "A", "Science"),

(6, "Brij", "XII", "B", "Science");


select * from student;

ADDING COLUMN IN TABLE USING ALTER COMMAND


alter table student add(Substream char(20) not null), (Percentage float not null);

desc student;
UPDATING VALUE
update student set Substream = "Computer Science" where roll = 1; update student set
Substream = "Biology" where roll = 2;
update student set Substream = "Maths" where roll = 3; update student set Substream = "NA"
where roll = 4;
update student set Substream = "Computer Science" where roll = 5; update student set
Substream = "Computer Science" where roll = 6;

select * from student;

update student set Percentage = 81 where roll = 6;


update student set Percentage = 69 where roll = 6;
update student set Percentage = 92 where roll = 6; 31

update student set Percentage = 55 where roll = 6;

update student set Percentage = 85 where roll = 6;

update student set Percentage = 72 where roll = 6;

select * from student;

alter table student add(Adhaar_card bigint not null);


desc student;
alter table student drop column Adhaar_card;
desc student;

ORDER BY COMMAND
select studentname,section from student order by Percentage;

AVERAGE COMMAND
select avg(Percentage) from student;

COUNT COMMAND
select count(*) from student;

MIN, MAX AND SUM COMMAND


select min(Percentage) from student;

select max(Percentage) from student;

select sum(Percentage)/count(*) from student where substream = "Computer Science";


DELETE A TUPLE FROM TABLE
delete from student where classstream = "Science";

select * from student;

PRACTICAL- 15
AIM- Write a programto Integrate SQL with Python by importing the MySQL
module record of employee and display the record.

OUTPUT

PRACTICAL- 16
AIM- Write a program to Integrate SQL with Python by importing the MySQL
module to search an employee using empno and if present in table display
the record, if not display appropriate method.

OUTPUT
PRACTICAL- 17
AIM- Write a program to Integrate SQL with Python by importing the MySQL
module to search a student using roll no, update the record

OUTPUT

PRACTICAL- 18
AIM- Write a program to Integrate SQL with Python by importing the MySQL
module to search a student using roll no, delete the record.
OUTPUT

PRACTICAL- 19
AIM- Write a program to Take a sample of ten phishing e-mails (or any text
file) and find most commonly occurring word(s)

OUTPUT

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy