Class 12 Python(083) Practical File (2023–24)

Vijaya Kumar Chinthala
6 min readOct 19, 2020

--

LIST OF PROGRAMS:

Program 1: Program to enter two numbers and print the arithmetic operations like +,-,*, /, // and %.

Program 2: Write a program to find whether an inputted number is perfect or not.

Program 3: Write a Program to check if the entered number is Armstrong or not.

Program 4: Write a Program to find factorial of the entered number.

Program 5: Write a Program to enter the number of terms and to print the Fibonacci Series.

Program 6: Write a Program to enter the string and to check if it’s palindrome or not using loop.

Program 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

Program 8: Read a file line by line and print it.

Program 9: Remove all the lines that contain the character “a” in a file and write it into another file.

Program 10 Read a text file and display the number of vowels/consonants/uppercase/lowercase characters in the file.

Program 11 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.

Program 12 Write a random number generator that generates random numbers between 1 and 6(simulates a dice)

Program 13 Write a python program to implement a stack using a list data structure.

Program 14 Take a sample of ten phishing e-mails (or any text file) and find most commonly occurring words.

Program 15 Read a text file line by line and display each word separated by a #

Program 16 Create a student table and insert data. Implement the following SQL commands on the student table:

ALTER table to add new attributes / modify data type / drop attribute

UPDATE table to modify data

ORDER By to display data in ascending / descending order

DELETE to remove tuple(s)

GROUP BY and find the min, max, sum, count and average

Program 17:Integrate SQL with Python by importing the MySQL module

Program 18:Integrate SQL with Python by importing the pymysql module

Program 1: Program to enter two numbers and print the arithmetic operations like +,-,*, /, // and %.

Output:

Program 2: Write a program to find whether an inputted number is perfect or not.

Output:

Program 3: Write a Program to check if the entered number is Armstrong or not.

Output:

OR

Output:

Program 4: Write a Program to find factorial of the entered number.

Output:

Program 5: Write a Program to enter the number of terms and to print the Fibonacci Series.

Output:

Program 6: Write a Program to enter the string and to check if it’s palindrome or not using loop.

Output:

OR

Output:

OR

Output:

Yes

Program 7: Recursively find the factorial of a natural number.

Output:

Program 8: Read a file line by line and print it.

Assume we have the following file, located in the same folder as Python:

Output:

Program 9: Remove all the lines that contain the character “a” in a file and write it into another file.

Assume we have the following file, located in the same folder as Python:

Output:

Program 10 Read a text file and display the number of vowels/consonants/uppercase/lowercase characters in the file.

Actual text file

Output:

Program 11 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.

Output:

OR

Output:

Program 12 Write a random number generator that generates random numbers between 1 and 6(simulates a dice)

Output:

Program 13 Write a python program to implement a stack using a list data structure.

Stack Concept:

Output:

Queue Concept:

Output:

Program 14 Take a sample of ten phishing e-mails (or any text file) and find most commonly occurring word(s)

Output:

Program 15 Read a text file line by line and display each word separated by a #

Output:

Program 16 Create a student table and insert data. Implement the following SQL commands on the student table:

ALTER table to add new attributes / modify data type / drop attribute

UPDATE table to modify data

ORDER By to display data in ascending / descending order

DELETE to remove tuple(s)

GROUP BY and find the min, max, sum, count and average

Program 17:Integrate SQL with Python by importing the MySQL module

Program 18:Integrate SQL with Python by importing the pymysql module

--

--