Practicals Word File
Practicals Word File
Coding Section-
Output-
Program – 2
Objective- To understand the concept of nested if-else
Coding Section-
Output-
Program – 3
Objective- To understand the concepts of while loop with if-else
statement.
Coding Section-
Output-
Program – 4
Objective- To understand the concepts of simple & nested for() loop.
Task- Write a program to input the value of x and n and print the sum of
the following series:
Coding Section-
Output-
Program – 5
Objective- To understand the concepts of while() loop.
Coding Section-
Output-
Program – 6
Objective- To understand the concepts of function and while()
loop
Output-
Program – 8
Objective- To understand the concepts of for() loop, function
parameters and return value
Coding section-
Output-
Program – 9
Objective- To understand the concept of string with function
Coding section-
Output-
Program – 11
Objective- To understand the concept of list as parameter to a
function.
Output-
Program – 13
Objective- To understand the concept of dictionary as an
argument to a function.
Coding section-
Output-
DATA FILES (TEXT FILES and BINARY FILES)
Program – 16
Objective- To understand the concept of open(), close(), reading of text
file using read() function and nested if-else.
Output-
Text files-
TEXT1.TXT
TEXT2.TXT
Program – 19
Objective- To understand the working of readlines() function.
Coding section-
Coding section-
[Adm no, Name, Per] …. Where these three values are: Adm no –
Admission Number of student (integer), Name - Name of student
(string), Per – Marks percentage of student (float) Write a Python
script to write the details of students in a binary file. Also read
contents of the file “STUDENT.DAT” and display the details of
those students whose percentage is above 75.
Coding section-
Output and Binary file (‘STUDENTS.DAT’)-
Binary File-
Program – 22
Objective- To understand the concept of read/write/update/delete
records from a binary file using dictionary as record object.
Task- Write a menu driven program for the binary file ITEMS.DAT
storing the objects of following type: {"ID":integer, "GIFT":string,
"Cost":float}
Coding section-
Output-
This record got updated to-
Records in file after updating and deletion-
Binary file-
“GIFTS.DAT”
CSV Files
Program – 23
Coding section-
Output-
emp.csv-
Program - 24
Output-
Authors.csv-
Program – 25
Coding section-
Output-
Authors.csv-
Data Structure
Program-26
Customer
ID Name Address Phone NoOfvisit
1 Ankit jain C-9, Yamuna Vihar, 9458795823 4
Delhi
2 Simranjeet G-89, Bandra, 9857589696 3
Mumbai
3 Sumedha H-90, Janakpuri, 7856987589 2
Madan Delhi
4 Simranjeet R-78, Worli, 9658758963 6
Mumbai
5 John T-90, California 9658758963 12
Coding Section-
Creating database company and table customer
Inserting values in Customer table
Q1
Q2
Q3
Q4
Q5
Q6
Program-28
Objective- To understand the use of create table with foreign
key, update, alter table and SQL joins.
Task- Create another table 'Bill' under 'company' database with
appropriate datatypes and insert the records.
Bill
BillNo Id Bill_Amoun
t
1 2 12500
2 1 15000
3 2 16000
4 3 25000
5 4 1400
Q2-
Q3-
Q4-
Q5-
Q6-
Q7-
Q8-
Q9-
Q10-
Program-29
Objevtive-To understand the use of create table with primary key, insert
into, select with where, like, between, order by clause, delete & aggregate
functions.
Coding Section-
Q1-
Q2-
Q3-
Q4-
Q5-
Q6-
Q7-
Q8-
Q9-
Q10-
Program-30
Objective-To understand the use of create table with primary
key, insert into, select with where, in, order by clause, equi-join &
aggregate functions.
Task- Create another table 'Student' under 'School' database with
appropriate datatypes and insert the records.
RNo SName Class TID
1 Ankur Gupta XI 101
2 Deepa Sharms XII 104
3 Ankit XI 102
4 Rahul Sharma XII 102
5 Raman Kumar XII 105
Coding section-
Q1-
Q2-
Q3-
Q4-
Q5-
Q6-
Q7-
Q8-
Q9-
Q10-
Program – 31
Objective- To understand the concept of mysql.connector,
connect(), cursor(), cursor.execute(), close() functions with 'create
databse', 'use', 'create table' commands of SQL.
Task-Write a Program to create a table 'EMP' under 'COMPANY'
database with following structure:
First_Name char(20) Not Null,
Last_Name char(20),
Age int(3)
Gender char(1)
Income Float(9,2)
DOJ date
Use MySQL database connectivity with Python.
Coding Section-
Program-32
Objective-To understand the concept of mysql.connector,
connect(), cursor(), cursor.execute(), commit(), close() functions
with 'use', 'insert into' commands of SQL.
Task-Write a program to insert at least 5 records in the table
created in previous program, also display its content on the
screen using MySQL database connectivity with Python.
Coding Section-
Output-
Program-33
Objective-To understand the concept of mysql.connector,
connect(), cursor(), cursor.execute(), close() functions with 'use',
'select' commands of SQL.
Task-Write a program to display those employee records who
have joined before 1st January, 2010 from 'EMP' using MySQL
database connectivity with Python. Also count number of such
employees.
Coding Section-
Output-
Program - 34
Objective-To understand the concept of mysql.connector,
connect(), cursor(), cursor.execute(), commit(), close() functions
with 'use', 'update' commands of SQL.
Task-Write a program to set date of join as 1st January, 2017 for
those employees whose date of join not entered, using MySQL
database connectivity with Python.
Coding Section-
Output-
Program – 35
Objective-To understand the concept of mysql.connector,
connect(), cursor(), cursor.execute(), commit(), close() functions
with 'use', 'delete' commands of SQL.
Task-Write a program to delete those records whose age more
than 60 years from 'EMP' table using MySQL database
connectivity with Python.
Coding Section-