CLASS 12 : PRACTICAL FILE PROGRAMS
1. Write a python script to take input for 2 numbers calculates and print their
sum, product and difference?
2. Write a python script to take input for 3 numbers, check and print the largest
number?
3. Write a python script to take input for 2 numbers and an operator (+ , – , * , / ).
Based on the operator calculate and print the result?
4. Write a python script to take input for a number and print its factorial?
5. Write a python script to Display Fibonacci Sequence.
6. Write a program with a user-defined function with string as a parameter
which replaces all vowels in the string with ‘*’.
7. Write a program that generates a series using a function while takes first and
last values of the series and then generates four terms that are equidistant e.g.,
if two number passed are 1 and 7 then function returns 1 3 5 7.
8. Write a program to check if a number is present in the list or not. If the
number is present, print the position of the number.
Print an appropriate message if the number is not present in the list.
9. Write a program to display the maximum and minimum values from the
specified range of indexes of a list.
10.Write a python program to read a file named “article.txt”, count and print total
alphabets in the file?
11.Write a python program to read a file named “story.txt”, count and print total
words starting with “a” or “A” in the file?
12.Write a python program to read a file named “story.txt”, count and print total
lines starting with vowels in the file?
13.Create a binary file with name and roll no. Search for a given roll number and
display the name, if not found display appropriate message.
14.Read a text file and display the number of vowels/ consonants/ uppercase/
lowercase characters and other than character and digit in the file.
15. Write a python program to implement binary search methods in a list data-
structure.
16.Write a python program to maintain book details like book code, book title
and price using stacks data structures? (implement push(), pop() and
display() functions)
17.Write a python program to maintain employee details like empno,name and
salary using Queues data structure? (Implementinsert (), delete () and display
() functions).
PYTHON-SQL CONNECTIVITY
18.Python interface with MySQL
Write a function to insert a record in table using python and MySQL interface.
19.Python interface with MySQL
Write a function to display all the records stored in a table using python and
MySQL interface.
20.Python interface with MySQL
Write a function to search a record stored in a table using python and MySQL
interface.
SQL Questions:
21. Consider the following tables product and client. Further answer
the questions given below.
TABLE:PRODUCT
TABLE:CLIENT
i. To display the details of those clients whose city is “delhi”.
ii. To display the details of products whose price is in the range of 50
to 100.
iii. TO DISPLAY THE client name ,city from table client and
productname and price from the table product with their
corresponding matching p_id .
iv. To increase the price of the product by 10.
22.Consider the following tables CONSIGNOR and CONSIGNEE. Further answer
the questions given below.
TABLE:CONSIGNOR
TABLE:CONSIGNEE
i. To display the names of all the consignors from Mumbai.
ii. To display the cneeid,cnorname,cnoradress,cneenmae,cneeaddress for
every consignee.
iii. To display consignee details in ascending order of cneename.
iv. To display number of consignee from each city.
23. Write queries for (i) to (iv) and find ouputs for SQL queries (v) to (viii), which
are based on the tables.
TABLE:VEHICLE
TABLE:TRAVEL
i. To display CNO, CNAME, TRAVELDATE from the table TRAVEL in
descending order of CNO.
ii. To display the CNAME of all customers from the table TRAVEL who are
travelling by vechicle with code Vo1 or Vo2
iii. To display the CNO and CNAME of those customers from the table
TRAVEL who travelled between ‘2015-1231’ and ‘2015-05-01’.
iv. To display all the details from table TRAVEL for the customers, who
have travel distacne more than 120 KM in ascending order of NOE
v. SELECT COUNT (*), VCODE FROM TRAVEL GROUP BY VCODE HAVING
COUNT (*) > 1;
vi. SELECT DISTINCT VCODE FROM TRAVEL :
24.Consider the following tables SCHOOL and ADMIN and answer this question :
Give the output the following SQL queries :
i. Select Designation Count (*) From Admin Group By Designation Having
Count (*) <2;
ii. SELECT max (EXPERIENCE) FROM SCHOOL;
iii. SELECT TEACHER FROM SCHOOL WHERE EXPERIENCE >12 ORDER
BY TEACHER;
iv. SELECT COUNT (*), GENDER FROM ADMIN GROUP BY
GENDER;TABLE: