Practical File CS 2025

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Practical Record programs – set 1

1. Write a program to show functionality of a basic calculator using functions.


2. Write a function in python which accept a number from user to return True, if the
number is a prime number else return False. Use this function to print all prime
numbers from 1 to 100.
3. Write a function in python which accept a list of marks of students and return the
minimum mark, maximum mark and the average marks. Use a function to test.
4. Create a random number generator that generates random numbers between 1
and 6 (simulates a dice). Throw the two dices 10 times and print their total.
5. Write a program in Python to search an element in a list and display the element
with its index position.

Set -2

6. WAP to read a text file “myfile.txt” line by line and display each word separated
by a #.
7. WAP to read a text file “myfile.txt” and display the number of vowels/
consonants/ uppercase/ lowercase characters in the file.
8. WAP that Removes all the lines that contain the character `a’ in a file and write it
to another file.
9. Write a program to create a text file and print the lines starting with ‘T’ or ‘P’. (Both
uppercase and lowercase).
10. Read a text file to print the frequency of the word ‘He’ and ‘She’ found in the file.
11. 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.
12. Create a binary file with roll number, name and marks. Input a roll number and
update the marks.
13. Read a CSV file from hard disc and print all the details on the screen.
14. Read a CSV file (containing item no, name, rate, QOH) from hard disc and print
all the items whose rate is between Rs 500 and Rs 1000.
15. Create a CSV file by entering user-id and password, read and search the
password for given userid.
16. WAP in Python to demonstrate linear search.
17. Write a Python program to implement a stack using a list data-structure.
18. WAP to pass an integer list as stack to a function and push only those elements
in the Stack which are divisible by 7.

Set – 3
19. Queries using Create database, Show databases, Use, Create table, Show
Tables, Describe, Rename, Alter, Select, From, Where, Insert, Update
commands.
20. Queries using DISTINCT, BETWEEN, IN, LIKE, IS NULL, ORDER BY, GROUP BY,
HAVING
21. Queries for Aggregate functions- SUM( ), AVG( ), MIN( ), MAX( ), COUNT( )
22. WAP to connect Python with MySQL using database connectivity and perform
the following operation on data in database: Create a table in database
23. WAP to connect Python with MySQL using database connectivity and perform
the following operation on data in database: Insert record in the table
24. WAP to connect Python with MySQL using database connectivity and perform
the following operation on data in database: Fetch records from the table using
fetchone( ), fetchall() and fetchmany( ).
25. WAP to connect Python with MySQL using database connectivity and perform
the following operation on data in database: Update record in the table and
Delete record from the table

You might also like