0% found this document useful (0 votes)
50 views6 pages

List of Practical

The document lists 25 practical programming problems involving Python and SQL. The problems cover topics like prime number series, Armstrong numbers, pattern printing, data structures, file handling, database operations, and more. Users are asked to write code to solve each problem.

Uploaded by

avikb703
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)
50 views6 pages

List of Practical

The document lists 25 practical programming problems involving Python and SQL. The problems cover topics like prime number series, Armstrong numbers, pattern printing, data structures, file handling, database operations, and more. Users are asked to write code to solve each problem.

Uploaded by

avikb703
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/ 6

List of Practical

1. WAP to print the Prime Fibonacci Series in Python up to Nth term. (Note : Value of N
should be user given.)
2. WAP to print the Armstrong Numbers from 1 to 1000.
3. WAP to generate the following pattern :
*
**
***
****
*****
******

4. WAP to create a list of N integers and print the 2nd largest and 2nd smallest numbers of
the list.
5. WAP to find the sum of the following series :
(1/a + 2/a^2 + 3/a^3 + … + n/a^n)
(Note : The value of ‘n’ is user input)

6. Write a python program to print Keys with Maximum value from the dictionary.

7. Write a Python program to get a string from a given string where all occurrences of its
first char have been changed to '$', except the first char itself.
Output:
Sample String : 'restart'
Expected Output : 'resta$t'

8. WAP to create a file ‘Book.csv’ that keeps the records (Book_No, B_Name and Publisher)
of Indian Story books. Now search for a specific book from the file. If found then it will
display the details of the book otherwise it will display “No such book found”.

9. Write a program to accept a string and calculate the number of upper case letter and
lower case letters using a user defined function string_test( ) passing the string as an
argument.

10. WAP that rotates the elements of a list so that the element at the first index moves to the
second index, the element at the second index moves to the third index, etc, and the
element in the last index moves to the first index.
11. A binary file Cinema.DAT has the following structure:

{mno:[mname,mtype]}
Where:
mno – Movie No.
mname – Movie Name
mtype – Movie Type
Write a user defined function findtype(mtype), that accepts mtype as parameter and
displays all the records from the binary file cinema.dat that have the value of movie type
as mtype.
12. A binary file "STUDENT.DAT" has structure (admission_number, Name, Percentage).
Write a program that has a function count_rec() that would read contents of the file
"STUDENT.DAT" and display the details of those students whose percentage is above 75.
Also display number of students scoring above 75%.

13. Write a menu driven Python program using function Push( ),Pop( ) and Display( ) to
implement the Stack. The Stack contains Student Details i.e, RollNo and StudentName.

14. WAP to create a tuple storing fist 9 terms of Fibonacci series.

A list contains following record of customer:


[Customer name, phone number, city]
Write the following user defined function in python to perform specific operation on
stack named ‘Status’.

(i) Push_element(): To push an object containing name and phone number of customers
who live in Goa to the stack.
(ii) Pop_element(): To pop the object from the stack and display them. Also the function
should display stack empty when there are no element in the stack.
15. Create a dictionary whose keys are month names and whose values are the number of
days in the corresponding months.
(i) Ask the user to enter a month name and use the dictionary to tell them how many
days are in the month.
(ii) Print out all the keys in alphabetical order.
(iii) Print out all the months with 31days.
(iv) Print out the (key-value) pairs sorted by the number of days in each month.

16. Write a menu driven Python program using Push( ), Pop( ) and Display( ) to implement
the Stack using List. The Stack contains Employee Details i.e, Employee Number,
Employee Name and Salary.
17. WAP to increase the salary by Rs. 10000/- of the employee having empno as 1265 in the
file Emp.dat.
18. WAP to generate the following pattern :
*
**
***
****
*****
******
*****
****
***
**
*
19. Consider the following tables ITEM and CUSTOMER. Write SQL commands for the following
statements.

Table: ITEM

I_ID Item_Name Manufacturer Price


PC01 Personal Computer ABC 35000
LC05 Laptop ABC 55000
PC03 Personal Computer XYZ 32000
PC06 Personal Computer COMP 37000
LC03 Laptop PQR 57000

Table: Customer

C_ID Customer_Name City I_ID


01 N Roy Delhi LC03
06 H Singh Mumbai PC03
12 R Pandey Delhi PC06
15 C Sharma Delhi LC03
16 K Agarwal Bangalore PC01

(i) To display the details of the customers whose city is Delhi.


(ii) To display the details of Item whose price is in the range 35000 to 55000.
(iii) To display the Customer_Name, City from table Customer and Item_Name and Price from table Item
with their corresponding matching ID.
(iv) To increase the price of all item by 5000 in the table Item.
(v) To display the details of those item whose name start with ‘P’ .
(vi) To display the Item name, Manufacturer and price of those items whose customers are from city ‘Delhi’.

20. Consider the following tables and write SQL commands for the followings :
Table : Vehicle
Note:
PERKS is Freight Charges per kilometre.
Km is kilometres Travelled
NOP is number of passengers travelled in vehicle.

(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
vehicle 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
distance more than 120 KM in ascending order of NOE.
(v) To display the details of the passengers as per the order of their Travel date.

21. Consider a table Product and Client which are created under database Cosmetics with structure
as follows:
Product (P_Id, Pname, Manufacturer, Price)
Client(C_Id, Cname, CCity, CProduct)
Write a python code to display the details of products whose price is in range 50 to 100 (Both values
included)
Use the following information for connections:
Host: Localhost
User: Admin
Password: Admin@123
22. Write Python code for following·
(i) Create a store database in mysql.
(ii) Create table customers with fields(c_code int,c_name char, ,C_city char)
(iii) Insert four records into the customer table.
(iv) Display all customer records in ascending order by field “c_name” of customer table.
23. Write a Python database connectivity script that deletes records from Category table of database
items that have name = ‘Stocktable’.

24. Consider the following tables and write SQL commands for the followings :
(i) To display TEACHERNAME, PERIODS of all teachers whose periods are more
than 25.
(ii) To display all the information from the table SCHOOL in descending order of
experience.
(iii) To display DESIGNATION without duplicate entries from the table ADMIN.
(iv) To display TEACHERNAME, CODE and corresponding DESIGNATION from tables
SCHOOL and ADMIN of Male teachers.
(v) To display no of teachers as per the designation.

25. Design a Python application that fetches only those records from Event table of
menagerie database where type is Kennel.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

You might also like