ppyy
ppyy
NO: 9
DATE:
AIM:
To Write a method Disp() in Python, to read the lines from poem.txt and
display those
Result:
Thus, the above Python program has been executed and the output is
verified successfully
EX.NO: 10
DATE:
CREATING A PYTHON PROGRAM TO COPY PARTICULAR LINES OF A
TEXT FILE
INTO AN ANOTHER TEXT FILE
AIM:
To write a python program to read lines from a text file "Sample.txt"
and copy those lines
into another file which are starting with an alphabet 'a' or 'A'
Result:
Thus, the above Python program has been executed and the output is
verified
successfully.
New.txt:
EX.NO: 11
DATE:
CREATING A PYTHON PROGRAM TO CREATE AND SEARCH RECORDS IN
BINARY FILE
AIM:
To write a Python Program to Create a binary file with roll number and
name.
Search for a given roll number and display the name, if not found
display appropriate
message.
Result:
Thus, the above Python program has been executed and the output is
verified
successfully.
EX.NO: 12
DATE:
CREATING A PYTHON PROGRAM TO CREATE AND UPDATE/MODIFY
RECORDS IN
BINARY FILE
AIM:
To write a Python Program to Create a binary file with roll number,
name, mark
and update/modify the mark for a given roll number.
Result:
Thus, the above Python program has been executed and the output is
verified
successfully.
EX.NO: 13
DATE:
CREATING A PYTHON PROGRAM TO CREATE AND SEARCH EMPLOYEE’S
RECORD
IN CSV FILE.
AIM:
To write a Python program Create a CSV file to store Empno, Name,
Salary and search any Empno
and display Name, Salary and if not found display appropriate message.
Result:
Thus, the above Python program has been executed and the output is
verified
successfully
EX.NO: 14
DATE:
AIM:
CREATING A PYTHON PROGRAM TO IMPLEMENT STACK
OPERATIONS(LIST)
To write a Python program to implement Stack using a list data-
structure, to perform
the following operations:
(i) To Push an object containing Doc_ID and Doc_name of doctors who
specialize
in "ENT" to the stack.
(ii) (ii) To Pop the objects from the stack and display them.
(iii)
(iv) (iii) To display the elements of the stack (after performing PUSH or
POP)
Result:
Thus, the above Python program has been executed and the output is
verified
successfully.
EX.NO: 15
DATE:
CREATING A PYTHON PROGRAM TO IMPLEMENT STACK
OPERATIONS(Dictionary)
AIM:
To Write a program, with separate user-defined functions to perform
the following
operations:
(i) To Create a function Push(Stk,D) Where Stack is an empty list and D is
Dictionary of Items.
from this Dictionary Push the keys (name of the student) into a stack,
where
the corresponding value (marks) is greater than 70.
(ii) To Create a Function Pop(Stk) , where Stk is a Stack implemented by
a list of student
names. The function returns the items deleted from the stack.
(iii) To display the elements of the stack (after performing PUSH or
POP).
Result:
Thus, the above Python program has been executed and the output is
verified
successfully
EX.NO: 16
DATE:
CREATING A PYTHON PROGRAM TO INTEGRATE MYSQL WITH PYTHON
(CREATING DATABASE AND TABLE)
AIM:
To write a Python Program to integrate MYSQL with Python to create
Database and Table
to store the details of employees.
Result:
Thus, the above Python program has been executed and the output is
verified
successfully.
EX.NO: 17
DATE:
AIM:
CREATING A PYTHON PROGRAM TO INTEGRATE MYSQL WITH PYTHON
(INSERTING RECORDS AND DISPLAYING RECORDS)
To write a Python Program to integrate MYSQL with Python by inserting
records to
Emp table and display the records.
Result:
Thus, the above Python program has been executed and the output is
verified
successfully.
EX.NO: 18
DATE:
AIM:
CREATING A PYTHON PROGRAM TO INTEGRATE MYSQL WITH PYTHON
(SEARCHING AND DISPLAYING RECORDS)
To write a Python Program to integrate MYSQL with Python to search an
Employee using
EMPID and display the record if present in already existing table EMP, if
not display the
appropriate message.
Result:
Thus, the above Python program has been executed and the output is
verified
successfully
EX.NO: 19
DATE:
AIM:
CREATING A PYTHON PROGRAM TO INTEGRATE MYSQL WITH PYTHON
(UPDATING RECORDS)
To write a Python Program to integrate MYSQL with Python to search an
Employee using
EMPID and update the Salary of an employee if present in already
existing table
EMP, if not display the appropriate message.
Result:
Thus, the above Python program has been executed and the output is
verified
successfully.
(B) Write a Query to list name of the students whose ages are
between 18 to 20.
SELECT NAME FROM STU WHERE AGE BETWEEN 18 AND 20;
(C) Write a Query to display the name of the students whose name is
starting with 'A'.
SELECT NAME FROM STU WHERE NAME LIKE 'A%';
(d) Write a query to list the names of those students whose name
have second alphabet 'n' in their
names.
SELECT NAME FROM STU WHERE NAME LIKE '_N%';
Ex.No: 23
SQL COMMANDS EXERCISE - 4
DATE:
AIM:
To write Queries for the following Questions based on the given table:
(B) Write a Query to change the fess of Student to 170 whose Roll
number is 1, if the existing fess
is less than 130.
UPDATE STU SET FEES=170 WHERE ROLLNO=1 AND FEES<130;
(C) Write a Query to add a new column Area of type varchar in table
STU.
ALTER TABLE STU ADD AREA VARCHAR(20);
(D) Write a Query to Display Name of all students whose Area
Contains NULL.
SELECT NAME FROM STU WHERE AREA IS NULL;
(E) Write a Query to delete Area Column from the table STU.
ALTER TABLE STU DROP AREA;