0% found this document useful (0 votes)
6 views20 pages

Ex. No. 13 Finding Most Commonly Occurring Word From 10 Phishing Emails Aim

Uploaded by

mathi
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)
6 views20 pages

Ex. No. 13 Finding Most Commonly Occurring Word From 10 Phishing Emails Aim

Uploaded by

mathi
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/ 20

EX. NO.

13
FINDING MOST COMMONLY OCCURRING WORD FROM 10 PHISHING EMAILS

AIM:
To write a program to take 10 sample phishing email, and find the most common word
occurring.
SOURCE CODE:
phishingemail=[
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]"
"[email protected]"
"[email protected]"
"[email protected]"
"[email protected]"]
myd={}
for e in phishingemail:
x=e.split(‘@’)
for w in x:
if w not in myd:
myd[w]=1
else:
myd[w]+=1
key_max = max(myd,key=myd.get)
print("Most Common Occuring word is :",key_max)
OUTPUT:

RESULT:
Thus, the above given program is executed successfully and the output is verified.
EX. NO. 14
STACK IMPLEMENTATION - 2

AIM:
To write a python program using function PUSH(Arr), using a list of numbers, push all
numbers divisible by 5 into the stack and display the stack if it has at least one element,
otherwise display appropriate error message.
SOURCE CODE:
def isEmpty(Arr):
if len(Arr)==0:
return True
else:
return False

def push(Arr,item):
if item%5==0:
Arr.append(item)
top=len(Arr)-1

def show(Arr):
if isEmpty(Arr):
print(‘No item found’)
else:
t=len(Arr)-1
print(‘(TOP)’,end=‘‘)
while(t>=0):
print(Arr[t],’<==‘,end=‘‘)
t=t-1
print()

Arr=[]
top=None
while True:
print(‘****** STACK IMPLEMENTATION USING LIST ******’)
print(‘1: PUSH’)
print(‘2: Show’)
print(‘0: Exit’)
ch=int(input(‘Enter choice:’))
if ch==1:
val=int(input(‘Enter no to push:’))
push(Arr,val)
elif ch==2:
show(Arr)
elif ch==0:
print(‘Bye’)
break

OUTPUT:

RESULT:
Thus, the above given program is executed successfully and the output is verified.
EX. NO. 15
MOST COMMONLY OCCURRING WORD AND FREQUENCIES OF WORDS
AIM:
To take a sample text file and find the most commonly occurring word. Also, list the
frequencies of words in the text file.
SOURCE CODE:
with open("read.txt",’r’) as fh:
contents=fh.read()
wordlist=contents.split()
wordfreq=[]
high=0
word=‘‘
existing=[]
for w in wordlist:
wcount=wordlist.count(w)
if w not in existing:
wordfreq.append([w,wcount])
existing.append(w)
if wcount>high:
high=wcount
word=w
print("The word’"+word+"‘ occurs maximum number of times,",high,"times.")
print("\n other words have these frequencies:")
print(wordfreq)
OUTPUT:

RESULT:
Thus, the above given program is executed successfully and the output is verified.
EX. NO. 16
MYSQL SET - 1

SOURCE CODE:
Q1.Write the query to create the above table and set the constraints for the attributes.
EXAMNO-PRIMARY KEY, NAME- NOT NULL ,MARK CHECK-MARK SHOULD
NOT EXCEED 500.
Query:
CREATE TABLE STUDENTS(
EXAMNO INT PRIMARY KEY,
NAME CHAR(20) NOT NULL,
CLASS VARCHAR(3),
SEC VARCHAR(3),
MARK INT CHECK(MARK<=500));

Q2: Write the query to insert the mentioned records into the table.
Query:
INSERT INTO STUDENTS VALUES (1201,’BALAGURU’,’XII’,’A2’,480);
INSERT INTO STUDENTS VALUES (1202,’SANJAI’,’XII’,’A1’,490);
INSERT INTO STUDENTS VALUES (1203,’LOKESH’,’XII’,’A1’,491);
INSERT INTO STUDENTS VALUES (1204,’PAVITHRAN’,’XII’,’A2’,451);
INSERT INTO STUDENTS VALUES (1205,’MONISH KANNAN’,’XII’,’A3’,300);
INSERT INTO STUDENTS VALUES (1206,’YOKESH’,’XII’,’A3’,421);
INSERT INTO STUDENTS VALUES (1207,’SOWMIYA’,’XII’,’A1’,398);
INSERT INTO STUDENTS VALUES (1208,’KARTHIGA’,’XII’,’A1’,350);
Q3.Write the query to display all the student records who is
studying in A1 SECTION.
QUERY:
SELECT * FROM STUDENTS WHERE SEC=‘A1’;

Q4.Write the query to display the records whose mark is not assigned.
QUERY:
SELECT * FROM STUDENTS WHERE MARK IS NULL;

Q5.Write the query to display whose marks in the range 400 to 450 (both values are
inclusive).
QUERY:
SELECT * FROM STUDENTS WHERE MARK BETWEEN 400 AND 450;

RESULT:
Thus, the above given program is executed successfully and the output is verified.
EX. NO. 17
MYSQL SET - 2

SOURCE CODE:

Q1.Write the query to display the student name,marks who secured more than 400 and less
than 487.
QUERY:
SELECT NAME,MARK FROM STUDENTS WHERE MARK>400 AND MARK<487;

Q2.Write the query to display the details whose name is starts with ‘P’ or ‘B’.
QUERY:
SELECT * FROM STUDENTS WHERE NAME LIKE ‘P%’ OR NAME LIKE ‘B%’;

Q3. Write the query to display the student name and section whose name contain ‘sh’.
QUERY:
SELECT NAME,SEC FROM STUDENTS WHERE NAME LIKE ‘%sh%’;

Q4. Write the query to display all the details sort by name in descending order.
QUERY:
SELECT * FROM STUDENTS ORDER BY NAME DESC;
Q5.Write the query to add 5 marks with the existing marks as ‘Updated marks’ and
display the details.
QUERY:
SELECT EXAMNO,NAME,CLASS,SEC,MARK+5 AS ‘Updated marks’ FROM STUDENTS;

RESULT:
Thus, the above given program is executed successfully and the output is verified.
EX. NO. 18
MYSQL SET - 3

SOURCE CODE:
Q1. Write the query to add a new column named as CITY with the data type
VARCHAR(30) and apply the default constraint ‘NOT MENTIONED’ in the students
table.
QUERY:
ALTER TABLE STUDENTS ADD COLUMN CITY VARCHAR(30) DEFAULT ("NOT
MENTIONED");

Q2.Write the query to change the order of the column in the students table as :
EXAMNO,NAME,CITY,CLASS,SEC,MARK
QUERY:
ALTER TABLE STUDENTS MODIFY CITY VARCHAR(30) AFTER NAME;

Q3.Write the query to redefine the NAME field size into VARCHAR(40) in the students
table.
QUERY:
ALTER TABLE STUDENTS MODIFY NAME VARCHAR(40);

Q4.Write the query to update the mark as 350 whose marks is null and update the section
is A3 whose section is null.
QUERY:
UPDATE STUDENTS SET MARK=350 WHERE MARK IS NULL;
UPDATE STUDENTS SET SEC="A3" WHERE SEC IS NULL;

Q5. Write the query to update the city of all records with the following cities
[CHENNAI,BENGALURU]
QUERY:
UPDATE STUDENTS SET CITY=‘CHENNAI’ WHERE EXAMNO IN (1201,1202,1203);
UPDATE STUDENTS SET CITY=‘BENGALURU’ WHERE EXAMNO IN (1204,1205,1206)
;
UPDATE STUDENTS SET CITY=‘PUDUCHERRY’ WHERE EXAMNO IN (1207,1208) ;
RESULT:
Thus, the above given program is executed successfully and the output is verified.
EX. NO. 19
MYSQL SET - 4

AIM:

SOURCE CODE:
DATABASE: HOSPITAL

Q1.Write the query to create DOCTOR TABLE and the PATIENT TABLE and keep
DOCID in patient table to be the foreign key with update and delete cascade.
QUERY:
CREATE DATABASE HOSPITAL;
USE HOSPITAL;
CREATE TABLE DOCTOR(
DOCID VARCHAR(3) PRIMARY KEY,
DNAME CHAR(20),
DEPT CHAR(25),
CITY CHAR(15),
SALARY INT);
INSERT INTO DOCTOR VALUES (‘D01’, ‘ASHWATHAN’, ‘ONCOLOGY’,
‘CHENNAI’,150000);
INSERT INTO DOCTOR VALUES(‘D02’,‘RAMYA’,‘GYNAECOLOGY’,
‘COIMBATORE’,140000);
INSERT INTO DOCTOR VALUES(‘D03’, ‘SRIRAM’, ‘DENTAL’, ‘BHOPAL’,180000);
INSERT INTO DOCTOR VALUES(‘D04’, ‘SANJAY’, ‘CARDIOLOGY’,
‘HYDERABAD’,160000);
INSERT INTO DOCTOR VALUES(‘D05’, ‘SRINITHI’, ‘PEDIATRICS’, ‘DELHI’,120000);
INSERT INTO DOCTOR VALUES(‘D06’, ‘SANTHOSH’, ‘PEDIATICS’,
‘BENGALURU’,140000);
INSERT INTO DOCTOR VALUES(‘D07’, ‘KARTHICK’, ‘CARDIOLOGY’,
‘JAIPUR’,180000);
INSERT INTO DOCTOR VALUES(‘D08’, ‘YASHIK’, ‘GYNAECOLOGY’,
‘AHMEDABAD’,195000);

CREATE TABLE PATIENT(


PATID VARCHAR(3) PRIMARY KEY,
PNAME VARCHAR(20),
APMDATE VARCHAR(12),
GENDER VARCHAR(7),
AGE INT,
DOCID VARCHAR(3),
FOREIGN KEY(DOCID) REFERENCES DOCTOR (DOCID) ON UPDATE CASCADE ON
DELETE CASCADE);

INSERT INTO PATIENT VALUES(‘P01’,’SATHISH’,’2022/08/19’,’MALE’,45,’D01’);


INSERT INTO PATIENT VALUES(‘P02’,’SUPRIYA’,’2022/09/21’,’FEMALE’,23,’D02’);
INSERT INTO PATIENT VALUES(‘P03’,’ARUNA’,’2022/10/20’,’ FEMALE’,43,’D08);
INSERT INTO PATIENT VALUES(‘P04’,’RAMESH’,’2022/08/25’,’MALE’,84,’D04’);
INSERT INTO PATIENT VALUES(‘P05’,’KUMAR’,’2022/09/23’,’MALE’,12,’D02’);
INSERT INTO PATIENT VALUES(‘P06’,’PRIYA’,’2022/09/14’,’FEMALE’,10,’D06’);
INSERT INTO PATIENT VALUES(‘P07’,’ROOPA’,’2022/08/13’,’FEMALE’,66,’D03’);
INSERT INTO PATIENT VALUES(‘P08’,’CHARLES’,’2022/10/12’,’MALE’,24,’D07’);
Q2.Write the query to display the count of male and female patients in the age between 40
and 50.
QUERY:
SELECT GENDER,COUNT(GENDER) FROM PATIENT WHERE AGE BETWEEN 40 AND
50 GROUP BY GENDER;

Q3.Write the query to display the patient id,name and age who fixed the appointment on
September month.
QUERY:
SELECT PATID,PNAME,AGE FROM PATIENT WHERE MONTH(APMDATE)=09;

Q4.Write the query to display the number of doctors in each dept.


QUERY:
SELECT DEPT,COUNT(DOCID) FROM DOCTOR GROUP BY DEPT;
Q5.write the query to display the sum of the salary of the doctors department wise.
QUERY:
SELECT DEPT,SUM(SALARY) FROM DOCTOR GROUP BY DEPT;

RESULT:
Thus, the above given program is executed successfully and the output is verified.
EX. NO. 20
MYSQL SET – 5

AIM:

SOURCE CODE:

Q1. Write the query to display patient name,doctor name,patient age and their
appointment date from the tables.
QUERY:
SELECT PNAME,DNAME,AGE,APMDATE FROM DOCTOR,PATIENT WHERE
DOCTOR.DOCID=PATIENT.DOCID;

Q2.Write the query to display the doctor id, doctor name and number of patients need to
visit.
QUERY:
SELECT D.DOCID,DNAME,COUNT(P.DOCID) AS ‘NO.PATIENT’ FROM DOCTOR
D,PATIENT P WHERE D.DOCID=P.DOCID GROUP BY P.DOCID;

Q3.Write the query to display the average salary of each dept from doctor table.
QUERY:
SELECT DEPT,TRUNCATE(AVG(SALARY),2) AS ‘AVERAGE SALARY’ FROM
DOCTOR GROUP BY DEPT;
Q4. Write the query to display the maximum and minimum salary of each department.
QUERY:
SELECT DEPT,MAX(SALARY),MIN(SALARY) FROM DOCTOR GROUP BY DEPT;

Q5.Write the query to delete record of the doctor id ‘D08’ and ‘D06’ from the table .
QUERY:
DELETE FROM DOCTOR WHERE DOCID IN(‘D06’,’D08’);
OUTPUT:

RESULT:
Thus, the above given program is executed successfully and the output is verified.
EX. NO.

AIM:

SOURCE CODE:

OUTPUT:

RESULT:
Thus, the above given program is executed successfully and the output is verified.
EX. NO.

AIM:

SOURCE CODE:

OUTPUT:

RESULT:
Thus, the above given program is executed successfully and the output is verified.
EX. NO.

AIM:

SOURCE CODE:

OUTPUT:

RESULT:
Thus, the above given program is executed successfully and the output is verified.
EX. NO.

AIM:

SOURCE CODE:

OUTPUT:

RESULT:
Thus, the above given program is executed successfully and the output is verified.

You might also like