Professional Documents
Culture Documents
Thane-Mumbai
A PRACTICAL FILE
For
SUBMITTED BY
Name: Purva Pawar
Roll No:
[1]
CERTIFICATE
This is to certify that the Miss. Purva Pawar of class
Roll No:
…………………………….. ……………………………..
Signature of Teacher External Examiner
Name: Mrs. Shilpa K
……….…………………
Signature of Principal
[2]
Index
S.No. Program Signature
1. Write a program to Input a string and
determine whether it is a palindrome
or not by defining a function.
2. Write a python program by defining a
function to find the sum of series
given below. S=(1*2)+(2*3)+--------
----+(19*20)
3. Write a program to Input a list/tuple
of elements, search for a given
element in the list/tuple.
4. Write a python program by defining a
function to sum the sequence given
below. Take the input n from the
user. 1+1/1!+1/2!+1/3!+⋯+1/n!
5. Write a program to enter a string and
display the string in reverse order.
6. Write a program to print fibonacci
series by defining a function.
7. Write a program for linear search.
[3]
9. Write a program to read a text file
line by line and display each word
separated by '#'.
10. Read a text file and display the
number of
vowels/consonants/uppercase/lowercase
characters in the file.
11. Remove all the lines that contain the
character 'a' in a file and write it to
another file.
12. Write a program to create a binary
file stu.dat with name, roll number
and marks of student and display the
data by reading the file.
13. Write a program to open file Stu.dat
and search for a given roll number and
display the name & marks, if not found
display appropriate message.
14. Write a program to open file Stu.dat
and input a roll number to update the
marks.
15. Write a program to read data from a
csv file and write data to a csv file.
16. Create a CSV file by entering user-id
and password, read and search the
password for given userid
17. Write a Python program to implement
[4]
a stack using list.
SQL Queries:
[5]
PYTHON PROGRAMS
Source Code:
Output:
[6]
2) Write a python program by defining a
function to find the sum of series given
below.
S=(1*2)+(2*3)+------------+(19*20)
Source Code:
OUTPUT:
[7]
3) Write a program to Input a list/tuple
of elements, search for a given element
in the
list/tuple.
Source Code:
OUTPUT:
[8]
4) Write a python program by defining a
function to sum the sequence given below.
Take the input n from the user.
1+1/1!+1/2!+1/3!+⋯+1/n!
Source Code:
OUTPUT:
[9]
5) Write a program to enter a string and
display the string in reverse order.
Source Code:
OUTPUT:
[10]
6) Write a program to print fibonacci
series by defining a function.
Source Code:
OUTPUT:
[11]
7) Write a program for linear search.
Source Code:
OUTPUT:
[12]
8) Write a program to generate random
numbers between 1 to 6 and check whether a
user won a lottery or not. (Simulates a dice)
Source Code:
OUTPUT:
[13]
9) Write a program to read a text file line
by line and display each word separated by #
Source Code:
OUTPUT:
[14]
10) Read a text file and display the
number of
vowels/consonants/uppercase/lowercase
characters in the file.
Source Code:
OUTPUT:
[15]
11) Remove all the lines that contain the
character ‘a’ in a file and write it to
another file.
Source Code:
OUTPUT:
[16]
12) Write a program to create a binary file
stu.dat with name, roll number and marks of
student and display the data by reading the
file.
Source Code:
OUTPUT:
[17]
13) Write a program to open file Stu.dat
and search for a given roll number and
display the name & marks,
if not found display appropriate message.
Source Code:
OUTPUT:
[18]
14) Write a program to open file Stu.dat
and input a roll number to update the marks.
Source Code:
OUTPUT:
[19]
15) Write a program to read data from a csv
file and write data to a csv file.
Source Code:
OUTPUT:
[20]
16) Create a CSV file by entering user-id
and password, read and search the password
for given userid.
Source Code:
OUTPUT:
[21]
17) Write a Python program to implement
a stack using list.
Source Code:
OUTPUT:
[22]
[23]
18) Create a table EMPLOYEE with
constraints
Source Code:
OUTPUT:
[24]
19) Insert data into the table
Source Code:
OUTPUT:
[25]
20) Add a new column in a table.
Source Code:
OUTPUT:
[26]
21) Change the data-type and size of an
existing column.
Source Code:
OUTPUT:
[27]
22) Write SQL queries using SELECT,
FROM, WHERE clause based on
EMPLOYEE
table.
[28]
Display the name of those female employees
who work in Mumbai.
Display the name of those employees whose
department is marketing or
RND.
[29]
List the name of employees who are not males
[30]
BETWEEN :-
IN:
[31]
LIKE:
IS NULL:
ORDER BY:
[32]
24) Queries for Aggregate functions-
SUM( ), AVG( ), MIN( ), MAX( ),
COUNT( )
A. AVG:
B) MIN:
C) MAX:
[33]
D) SUM:
E) COUNT
[34]
25) Write a program to connect Python with
MySQL using database connectivity and
perform the following operations on data in
database: Create Table, Insert the data,
Fetch the records and Update the records.
Note: Use “school” data base.
A) SOURCE CODE:
[35]
OUTPUT:
B) SOURCE CODE:
[36]
OUTPUT:
[38]