BCA 3rd Year LAB MANUAL-Python Lab
BCA 3rd Year LAB MANUAL-Python Lab
1. Write a Python program to demonstrate the use of variables, assignment, and basic arithmetic
operations.
2. Create a Python script to count the number of vowels, reverse a string, and convert the string
to uppercase.
3. Implement a Python program to demonstrate string slicing, indexing, and using string
operators like concatenation and repetition.
4. Write a Python program that checks if a given integer is even or odd using an if-else
statement.
5. Create a Python script to print the Fibonacci sequence up to a given number n using a while
loop.
6. Define a class Circle with attributes radius and methods to calculate area and circumference.
7. Write a Python program to demonstrate single inheritance by creating a base class Animal and
a derived class Dog. Implement methods to show polymorphism.
8. Create a Python script to remove duplicates from a list of numbers and sort it in ascending
order.
9. Implement a Python program to demonstrate tuple operations and built-in set methods like
union, intersection, and difference.
10. Write a Python script to identify the type of each element in a list of mixed data types using the
type() function.
11. Create a Python program that takes user input to create a dictionary, then allows searching for
keys and displays the corresponding values.
12. Write a Python script to create a nested dictionary representing a student database and
perform operations to add, modify, and display student details.
13. Develop a Python program that reads a text file, counts the number of words, and writes the
word count to a new file.
14. Implement a Python script that uses pickle to save a dictionary object to a file and then load it
back, displaying the data.
15. Write a Python program to list all files in a given directory and its subdirectories.
16. Create a Python program that uses regular expressions to validate email addresses from a list
of inputs.
17. Write a Python script to search for a specific word in a text file and replace it with another word
using regular expressions.
18. Develop a Python program that demonstrates the use of try, except, and finally blocks by
handling division by zero errors.
19. Implement a Python class that defines a custom exception NegativeNumberError and raises
this exception when a negative number is input.
20. Write a Python script that uses assertions to check whether a list is sorted, raising an assertion
error if it is not.
21. Write a Python program to connect to a SQLite database, create a table Employee, and insert
data into it.
22. Develop a Python script to connect to a SQL database, execute a query to retrieve data, and
display the results.
23. Implement a Python program to read database configuration from a file and use it to establish
a connection to the database.
24. Create a Python program that demonstrates the creation of two threads where one thread
prints even numbers and the other prints odd numbers.
25. Write a Python script that uses thread synchronization (using Lock) to ensure that two threads
access a shared resource without conflicts.