Python Programming- Practical
1 Write a program to perform logical AND, OR and NAND operation.
2 WAP to find factorial of a number.
3 WAP to perform number type conversions.
4 WAP to find sin, cos and tan of a given value in degree.
5 WAP to display all the even numbers from 1 to n.
6 Write a python program to compute the product of digits of a given number.
7 WAP to generate and display Fibonacci sequence (first ten terms).
8 Write a python program to calculate factorial of a given number using math library.
9 WAP to find sum of all natural numbers between 1 to n using recursion.
10 Write a python program to find reverse of a given number.
11 Write a program to generate Cipher text from Plain text using functions.
12 WAP to find position of a substring in a given string.
13 Write a python program to find occurrences of a substring from a given string.
14 Write a program to find position and count of occurrences of a character/substring(few characters of a word but not complete word) from a given string.
15 Create two tuples of names and contact numbers using python. Create a phonebook from these two tuples in such a way so that a contact number can be searched using name directly.
16 a) Use concept of dictionaries in python programming and make a record of Airline passenger list (Name, Ticket number).
17 a) Maintain two sets with record of names of players of Hockey and Javelin Throw.
18 WAP to read one file and write its contents into another file.
19 Write a python program to read two files and write their contents into a third file.
20 WAP to count the number of lines, words and characters in the file.
21 WAP to access private attribute and private method outside the class.
22 WAP to initialize attributes of a class using constructor.
23 WAP to access protected attribute and method outside the class.
24 Write a python program to pass an object as parameter of a method.
25 Write a program in python for following operations: Object3 = Object1 * Object2 where objects are of same class.
26 Write a program for following: i) Create four classes: Students, Academics, Sports and Result ii) Data members: Students: Name, Rollno, get_details(string, int) Academics: Marks1, Marks2, Marks3, get_marks(float, float, float) Sports: Grades, get_grades(float) //Grades: 1.0 to 10.0 Result: Total_Marks, Output_result() iii) Use appropriate inheritance to display the results. Hint: //Hybrid Inheritance ------class Students{-- } class Academics : public Students //single inheritance {-- } class Sports{-- } class Result : public Academics, public Sports //Multiple Inheritance { }.
27 WAP to solve Diamond problem in python. Hint: Use super(). On constructors in derived classes.
28 Write a program to search a pattern using regular expresssions. Pattern is any five letter string starting with 'h' and ending with 'o'. Hint: re.match(‘^h…o$’).
29 WAP to split a string where ':' is occuring using regular expressions.
30 Write a python program to extract numbers from a given alphanumeric string.
31 WAP to search a pattern where a string contains first name with 3 characters followed by space and then followed by 'Kumar'. Hint: Ram Kumar.
32 WAP to find all the names from a contact list where last name is 'Kumar'.
33 WAP to find names starting with character 'A' and last name 'Ahuja'.
34 Write a python program to replace first letter 'a' from a alphanumeric string with 'A'. Hint: a111452 -> A111452 re.sub().
35 WAP to handle key board interrupt exception.
36 Write a python program to manually raise an exception when the given number is even.
37 Create a table “Student” and insert following values into it: Name, Roll_no, Age, Gender, Stream, Institute, University.
38 Create a table “Employee” with following structure: <First Name, Last Name, Emp_Id, Designation, Age, Gender, Income> and select rows where income < 200000.