0% found this document useful (0 votes)
6 views5 pages

Programming in Python Lab

The document outlines a comprehensive list of programming experiments and mini projects for a Python lab course. It is divided into four units covering Python basics, data structures, object-oriented programming, and file handling, with each unit containing multiple programming tasks. Additionally, it includes eight mini project ideas that students can undertake individually or in groups, focusing on practical applications of Python programming.

Uploaded by

kartikchauhan190
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

Programming in Python Lab

The document outlines a comprehensive list of programming experiments and mini projects for a Python lab course. It is divided into four units covering Python basics, data structures, object-oriented programming, and file handling, with each unit containing multiple programming tasks. Additionally, it includes eight mini project ideas that students can undertake individually or in groups, focusing on practical applications of Python programming.

Uploaded by

kartikchauhan190
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

DEPARTMENT OF COMPUER SCIENCE AND ENGINEERING

Programming in Python Lab


List of Experiments
UNIT–I: Python Basics & Control Structures

1. Write a program to calculate the area of a rectangle using user-input length and
width.
2. Write a program to calculate the final price of an item including sales tax.
3. Write a program to compare two numbers and print the larger number or indicate
equality.
4. Write a program to add a user’s age and favorite number and display the result.
5. Write a program to check whether a number is odd or even.
6. Write a program to classify student grades based on marks using if–elif–else.
7. Write a program to check divisibility of a number by 3 and 5.
8. Write a program to identify the type of triangle based on given sides.
9. Write a menu-driven bill calculator using conditional statements.
10. Write a program to check voting eligibility based on age.
11. Write a program to print even numbers within a given range using loops.
12. Write a program to compute the sum of first N natural numbers.
13. Write a program to calculate factorial of a number using loops.
14. Write a program to check whether a given number is prime.
15. Write a program to generate number patterns using nested loops.

UNIT–II: Lists, Strings, Dictionaries & Functions

Lists
16. Write a program to find the maximum and minimum elements in a list.
17. Write a program to compute the sum and average of list elements.
18. Write a program to count occurrences of an element in a list.
19. Write a program to reverse a list.
20. Write a program to remove duplicate elements from a list.
21. Write a program to merge two lists and sort them.
22. Write a program to find the second largest element in a list.
23. Write a program to check common elements between two lists.
24. Write a program to rotate a list by a given number of positions.
25. Write a Python program that takes a nested list containing integers and sublists
(e.g., [[1, 2], [3, [4, 5]]]) and produces a single flattened list containing all elements in
left-to-right order (e.g., [1, 2, 3, 4, 5]). The program should handle nesting of arbitrary
depth using iteration or recursion.

Strings
26. Write a program to reverse each word in a string while preserving word order.
27. Write a program to validate a password based on predefined conditions.

Dictionaries
28. Write a program to create, access, add, and remove key-value pairs in a dictionary.
29. Write a program to merge two dictionaries.
30. Write a program to count character frequency in a string using a dictionary.
31. Write a program to invert a dictionary.
32. Write a program to sort a dictionary by values.
33. Write a program to implement and access a nested dictionary.

UNIT–III: Object-Oriented Programming & Exception Handling

34. Write a program to model a Car class with attributes and methods.

35. Write a program to design an Employee class and implement salary increment logic.

36. Write a program to handle division by zero using exception handling.

37. Write a program to handle file-not-found exception while opening a file.

UNIT–IV: File Handling, OS Modules & Web

File Handling
38. Write a program to read and display contents of a file.
39. Write a program to write and append data to a file.
40. Write a program to check file existence using [Link].
41. Write a program to save and retrieve data using the pprint module.
42. Write a program to store and retrieve dictionary data using the shelve module.
43. Write a program to combine contents of multiple files.
44. Write a program to calculate file size using [Link].

OS, ZIP & Web


45. Write a program to copy and move files using shutil.
46. Write a program to compress and extract files using the zipfile module.
47. Write a program to display directory tree using [Link].
48. Write a program to open a URL using the webbrowser module.
49. Write a program to scrape data from a website and store it in a file.
50. Write a program to extract all hyperlinks from a web page.
Programming in Python Lab
List of Mini Projects
(Students have to perform any ONE or TWO mini projects in groups or individually)

Mini Project 1: Student Record Management System


 Use lists/dictionaries to store student data
 Calculate average marks
 Handle invalid input using exception handling
 Pretty-print student records

Mini Project 2: Product Inventory Management


 Create a Product class (name, price, quantity)
 Validate price using exception handling
 Display inventory using formatted output

Mini Project 3: File-Based Contact Book


 Store contact details in files
 Search, add, and update records
 Use file handling and [Link]

Mini Project 4: Password Validation Tool


 Validate password strength using string operations
 Enforce rules (length, digits, symbols)
 Handle incorrect inputs gracefully

Mini Project 5: Employee Salary Processing System


 Use Employee class
 Calculate salary increment
 Store records using dictionaries and files
Mini Project 6: Log File Analyzer
 Read log files
 Count word or pattern frequency
 Display results using pretty printing

Mini Project 7: File Organizer Utility


 Organize files into folders by type
 Use os, shutil, and zipfile
 Compress organized folders

Mini Project 8: Web Data Scraper


 Scrape web content using BeautifulSoup
 Save extracted data into files
 Handle network errors using exceptions

You might also like