Python Assignment 1
Topic: Data Types in Python
Business Scenarios
Scenario 1: Retail Store Inventory Management
• List: Store a list of product names available in a retail store.
o Tasks:
1. Add a new product to the list.
2. Remove a discontinued product.
3. Sort the list alphabetically.
4. Find the total number of products.
• Tuple: Define the details of a product as (Product ID, Product Name, Price,
Stock Quantity).
o Tasks:
1. Access specific details using indexing and slicing.
2. Count occurrences of a specific value (e.g., department name).
• Set: Keep track of unique product categories (e.g., {"Electronics",
"Groceries"}).
o Tasks:
1. Add a new product category.
2. Perform set operations like union, intersection, and difference between
two sets.
• Dictionary: Map product IDs to their details, e.g., {101: {"Name": "Laptop",
"Category": "Electronics"}}.
o Tasks:
1. Add a new product.
2. Update stock quantity for an existing product.
3. Remove a discontinued product.
4. Access all product IDs and details.
Scenario 2: Customer Relationship Management (CRM)
• List: Maintain a list of customer names who signed up for a loyalty program.
o Tasks:
1. Add a new customer name.
2. Remove a customer who canceled their membership.
3. Sort the list alphabetically.
4. Find the number of customers.
• Tuple: Store a customer’s details as (Customer ID, Name, Email, Phone).
o Tasks:
1. Access the customer’s name and phone number.
2. Slice the tuple to get specific fields (e.g., Name, Email).
• Set: Track unique customer locations (e.g., {"New York", "Los Angeles"}).
o Tasks:
1. Add a new location to the set.
2. Perform union, intersection, and difference operations on customer
locations from different branches.
• Dictionary: Map customer IDs to their purchase history (e.g., {1001: ["Laptop",
"Headphones"]}).
o Tasks:
1. Add a new purchase for a customer.
2. Update the purchase history for an existing customer.
3. Remove a customer from the dictionary.
Scenario 3: Employee Data in a Company
• List: Store a list of employee names.
o Tasks:
1. Add a new employee.
2. Remove an employee who resigned.
3. Sort the list by names.
• Tuple: Record an employee’s data as (Employee ID, Name, Department,
Salary).
o Tasks:
1. Access the department of an employee using indexing.
2. Slice the tuple to get the employee’s name and department.
• Set: Maintain a set of unique departments (e.g., {"HR", "Finance", "IT"}).
o Tasks:
1. Add a new department.
2. Perform set operations like union and difference between departments
of two company branches.
• Dictionary: Map employee IDs to salary details (e.g., {2001: {"Name": "Alice",
"Salary": 75000}}).
o Tasks:
1. Add a new employee.
2. Update the salary of an existing employee.
3. Remove an employee.
Scenario 4: E-commerce Website Data
• List: Keep a list of trending products on the homepage.
o Tasks:
1. Add a new product.
2. Remove a product no longer trending.
3. Sort the products alphabetically.
• Tuple: Define the details of an order as (Order ID, Customer ID, Product ID,
Total Amount).
o Tasks:
1. Access the Customer ID and Product ID using indexing.
2. Slice the tuple to get the Order ID and Total Amount.
• Set: Maintain a set of payment methods (e.g., {"Credit Card", "PayPal"}).
o Tasks:
1. Add a new payment method.
2. Find common and unique payment methods between two e-commerce
websites.
• Dictionary: Map order IDs to their respective details (e.g., {3001: {"Customer
ID": 1001, "Total Amount": 50000}}).
o Tasks:
1. Add a new order.
2. Update the total amount of an existing order.
3. Remove an order.
Scenario 5: Hotel Management System
• List: Record the names of available rooms for booking.
o Tasks:
1. Add a new room to the list.
2. Remove a room that is under maintenance.
3. Find the total number of available rooms.
• Tuple: Define a reservation as (Reservation ID, Customer Name, Room Number,
Check-In Date, Check-Out Date).
o Tasks:
1. Access the Room Number and Check-In Date using indexing.
2. Slice the tuple to get the Customer Name and Room Number.
• Set: Keep track of unique room types (e.g., {"Single", "Double", "Suite"}).
o Tasks:
1. Add a new room type.
2. Perform union, intersection, and difference operations with room types
from another hotel.
• Dictionary: Map room numbers to their details or current reservations (e.g., {101:
{"Type": "Suite", "Price": 200}}).
o Tasks:
1. Add a new room with its details.
2. Update the price for a specific room type.
3. Remove a room from the dictionary.
Scenario 6: Online Learning Platform
• List: Store a list of courses available on the platform.
o Tasks:
1. Add a new course to the list.
2. Remove a course that is no longer offered.
3. Sort the list of courses alphabetically.
• Tuple: Define a student’s details as (Student ID, Name, Course Enrolled,
Grade).
o Tasks:
1. Access the student’s grade using indexing.
2. Slice the tuple to get the student’s name and enrolled course.
• Set: Track unique courses offered (e.g., {"Data Science", "Machine Learning",
"AI"}).
o Tasks:
1. Add a new course to the set.
2. Find courses that overlap between two learning platforms.
• Dictionary: Map student IDs to their grades and enrolled courses (e.g., {3001:
{"Name": "John", "Course": "Data Science", "Grade": "A"}}).
o Tasks:
1. Add a new student.
2. Update the grade for a student.
3. Remove a student who has completed the course.