0% found this document useful (0 votes)
17 views

Practical List of Python For Class 12

The document provides a practical list of 20 Python programming exercises including writing functions to check Armstrong numbers, compute x to the power of n, calculate factorials and Fibonacci series recursively, sort lists using bubble sort, read and analyze text files, implement stacks and queues, and interface with MySQL databases to perform queries and CRUD operations.

Uploaded by

shradi0612
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Practical List of Python For Class 12

The document provides a practical list of 20 Python programming exercises including writing functions to check Armstrong numbers, compute x to the power of n, calculate factorials and Fibonacci series recursively, sort lists using bubble sort, read and analyze text files, implement stacks and queues, and interface with MySQL databases to perform queries and CRUD operations.

Uploaded by

shradi0612
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Practical List Of Python

1. Write a python script to take input for a number check if the entered
number is Armstrong or not.
2. WAP to compute xn of given two integers x and n using Function.
3. Write a program to input the value of x and n and print the sum of the
following series using function:
 1+x+x2+x3+x4+ ............xn
 1-x+x2-x3+x4 + ......... xn
 x + x2/2 + x3/3 + x4/3 + ...........+ xn
 x + x2/2! + x3/3!+ x4/4! + ............ xn
 x + x2/3! + x3/5! + x4/7! + ............ xn
4. Write a python program to evaluate factorial of a number by using
Recursive function.
5. Write a Program to Display the terms of a Fibonacci series using
Recursive Function.
6. Write a python program which take Input as string and determine whether
it is a palindrome or not.
7. Write a python script which takes Input as list of numbers and swap
Elements at the even location with the elements at the odd location.
8. Write a python script which takes Input as list of elements, Search
(Sequential) for a given element in the list.
9. Write a Recursive function in python BinarySearch(Arr,l,R,X) to search
the given element X to be searched from the List Arr having R
elements, where l represents lower bound and R represents the upper
bound.
10. Write a python script which takes Input as list of elements, arrange given
element in the list in ascending order using Bubble sorting.
11. Write a Python program to input names of „n‟ countries and their capital
and currency, store it in a dictionary and display in tabular form. Also
search and display for a particular country.
12. Write a python program to read a file named “story.txt”, count and print
total words starting with “a” or “A” in the file?
13. Write a python program to read a file named “article.txt”, count and print
total alphabets in the file?
14. Write a python program to read a file named “article.txt”, count and

print the following:


(i). length of the file(total characters in file)
(ii).total alphabets
(iii). total upper case alphabets
(iv). total lower case alphabets
(v). total digits
(vi). total spaces
(vii). total special characters

15. Write a function in python to count the number of lines in a text file
„STORY.TXT‟ which is starting with an alphabet „A‟
16. Write a Python program to create a binary file with name and roll number.
Search for a given roll number and display the name, if not found display
Appropriate message.
17. A binary file “STUDENT.DAT” has structure (admission_number, Name,
Percentage). Write a function countrec() in Python 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%.
18. Write a python program to maintain book details like book code, book title
and price using stacks data structures? (implement push(), pop() and
traverse() functions).
19. Write a python program to maintain employee details like empno,name
and salary using Queues data structure? (implement insert(), delete() and
traverse() functions)
20. Write a function to insert a record in table using python and MySQL
interface.
21. Write a function to display all the records stored in a table using
python and MySQL interface.
22. Write a function to search a record stored in a table using python and
MySQL interface.

SQL Questions:

Consider the following tables product and client. Further answer the questions given
below.

TABLE: PRODUCT

P_ID PRODUCTNAME MANUFACTURER PRICE


TP01 TALCOM POWDER LAK 40
FW05 FACE WASH ABC 45
BS01 BATH SOAP ABC 55
SH06 SHAMPOO XYZ 120
FW12 FACE WASH XYZ 95
TABLE: CLIENT

C_ID CLIENTNAME City P_ID


01 COSMETIC SHOP Delhi FW05
06 TOTAL HEALTH Mumbai BS01
12 LIVE LIFE Delhi SH06
15 PRETTY WOMAN Delhi FW12
16 DREAMS Banglore TP01

1) To display the details of those clients whose city is “delhi”


2) To display the details of products whose price is in the range of 50 to 100
3) TO DISPLAY THE client name ,city from table client and productname and
price from the table product with their corresponding matching p_id.
4) To increase the price of the product by 10.
5) Select distinct city from client;

You might also like