Bachelor of Computer Science and Engineering
Practical File
Course Name: Python Programming Lab
Course Code: CSE25203P
Semester: 2nd
Submitted to: Submitted by:
Dr. Aarti Chugh Aditya
Associate Professor 221302007
School of Computer Science & Engineering
IILM University, Gurugram
INDEX
[Link] Name of the Experiment Page Date Signature
Number
Practical 1
Aim: To learn operators of Python.
1. WAP to perform different arithmetic operations on numbers in python.
2. WAP for file permission management using bitwise operators.
3. WAP to show use of various Math Module functions.
4. A company wants to track the monthly salary of its employees, including increments and
deductions. Write a Python program that:
• Takes an employee's base salary as input.
• Applies a performance bonus of 10% of the salary.
• Deducts a tax of 12% from the updated salary.
• Applies a monthly deduction (e.g., loan repayment) based on user input.
• Updates the salary using assignment operators (+=, -=, *=, /=) at each step.
• Displays the final salary after all adjustments.
Practical 2
Aim: To understand use of conditional and iterative statements
1. Write a Python program to demonstrate the use of identity operators (is, is not).
Take two inputs from the user and store them in two variables.
Check if both variables refer to the same object using the is operator.
Check if they refer to different objects using the is not operator.
Print the results for both conditions.
2. WAP to print a pattern
*
**
***
****
3. WAP to check if a number is prime or not.
4. Write a Python program that prints numbers from 1 to 10.
If the number is 5, skip printing it using the continue statement.
If the number is 8, stop the loop using the break statement.
Practical 3
Aim: Implement List, Tuple and Sets.
1. WAP to show various list operations: creation, access an element, update, delete, sort, search
an element.
2. To write a Python program find the maximum and minimum of a list of numbers.
3. WAP to create a tuple, print its elements and perform following:
i. Accessing Elements in a Tuple using Indexing and Slicing
ii. Updating a Tuple using Concatenation and Repetition
iii. Deleting a Tuple
iv. Iterating Over a Tuple and searching elements using linear search
4. WAP to show set intersection, union, set difference, symmetric difference operations.
5. Background: You are a software developer intern at a local grocery store, "FreshMart." The
store is looking to enhance customer experience by developing a simple application that allows
users to manage their grocery lists efficiently. Your task is to create a Simple Grocery List
Manager using Python.
Objective: The goal of the application is to allow users to add, remove, view, and clear items on
their grocery list. This will help customers keep track of what they need to buy, making their
shopping trips more organized and efficient.
Application Features
Add Items: Users can input items they want to purchase. For example, if a user wants to buy
"milk," they can add it to their list.
Remove Items: Users can remove items from their list if they change their mind or have already
purchased them.
View List: Users can view all the items currently on their grocery list at any time.
Clear List: After shopping, users can clear all items from their list with a single command.
Practical 4
Aim: Implement String and its functions.
1. Create a string and show string slicing, replication, concatenation and replacement.
2. WAP to check if a Given String is a Heterogram.
3. WAP to read a line and print the statistics: No. of Uppercase, lowercase letters, digits and
alphabets.
Practical 5
Aim: Implementation and working with dictionary.
1. Scenario:
Imagine you are at a grocery store, and the cashier maintains a dictionary where each item has a price.
Task 1: Ask the system for the price of an item.
Task 2: Calculate the total bill for a few items.
Task 3: Let user chooses an item from dictionary and then enter quantity. Do calculations according to
this. Make use of loop which ask user whether he/she wants to add more items.
2. WAP to find word count using Get function and dictionary.
3. WAP to create a nested dictionary, access it items using multiple key hierarchy, traversing and adding
new key-value pairs to it.