Problem 1: Student Grade Management System
Sample Input:
records = [
(101, "Alice", "Math", 85),
(102, "Bob", "Math", 92),
(101, "Alice", "Physics", 78),
(103, "Charlie", "Math", 65)
Task:
Create a dictionary:
Key = student_id
Value = {
"name": student_name,
"subjects": [(subject, marks)],
"average_marks": float
Desired Output
{
101: {
"name": "Alice",
"subjects": [("Math",85),("Physics",78)],
"average_marks": 81.5
}
Problem 2: Inventory and Sales Analyzer
Sample Input:
inventory = [
("Laptop", 15, 45000),
("Mouse", 50, 800),
("Laptop", 5, 42000)
sales = [
("Laptop", 3),
("Mouse", 10)
Task:
Return:
{ item_name: (updated_stock, revenue, is_low_stock) }
Desired Output
{
"Laptop": (12,135000,False),
"Mouse": (40,8000,False)
Problem 3: Merge Student Data (No Loops)
Sample Input:
basic_info = [
(101, "Alice", 20),
(102, "Bob", 21)
]
scores = [
(101, "Math", 85),
(101, "Physics", 78)
Task: Write a function merge_student_data(basic_info, scores) that returns a dictionary
Return:
{ id: (name, age, [(subject,marks)], total_marks) }
(No loops allowed)
Desired Output
{
101: ("Alice",20,[("Math",85),("Physics",78)],163)
Problem 4: Inventory Price Calculator (No Loops)
Sample Input:
inventory = [
("Laptop", 5, 50000),
("Mouse", 20, 800)
discounts = [
("Laptop", 10)
]
Task: Write a function calculate_final_prices(inventory, discounts) that returns a dictionary
Return:
{ item: (final_price, total_value) }
(No loops allowed)
Desired Output
{
"Laptop": (45000.0,225000.0),
"Mouse": (800.0,16000.0)