Skip to content

Commit a5cebdd

Browse files
committed
update
1 parent 7a38af3 commit a5cebdd

1 file changed

Lines changed: 158 additions & 0 deletions

File tree

docs/labs/lab-09.md

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,164 @@ print(count) # 25
498498

499499
---
500500

501+
## Exercise 5: High Performers Filter <Badge type="warning" text="Task" />
502+
503+
Navigate to `/labs/lab09/exercise5/exercise5.py`.
504+
505+
**Background:**
506+
507+
A teacher wants to identify students who excelled in all subjects (scoring above 85 in each) to feature them in the school newsletter.
508+
509+
**Task:**
510+
511+
Write a function `high_performers(filename)` that identifies these exceptional students and returns how many there are along with their names
512+
513+
**Parameters:**
514+
- `filename` (str): Path to CSV file
515+
516+
**Returns:**
517+
- Dictionary with keys:
518+
- `"count"` (int): Number of high performers
519+
- `"names"` (set): Set of student names
520+
521+
**Example:**
522+
```python
523+
result = high_performers("data/students.csv")
524+
print(result)
525+
# {
526+
# "count": 8,
527+
# "names": {"Ali", "Sara", "Hassan", "Fatima", "Omar", "Layla", "Yusuf", "Amira"}
528+
# }
529+
```
530+
531+
---
532+
533+
## Exercise 6: Warehouse Inventory Alert <Badge type="warning" text="Task" />
534+
535+
Navigate to `/labs/lab09/exercise6/exercise6.py`.
536+
537+
**Background:**
538+
539+
A warehouse manager needs to identify critical inventory issues. Products are critical when their current stock has fallen below the reorder threshold and they haven't been restocked in over 30 days. These items need immediate attention.
540+
541+
**Task:**
542+
543+
Write a function `critical_inventory(filename)` that identifies which products are in critical status and returns the total number of products tracked, how many are critical, and which specific products need immediate restocking
544+
545+
**Parameters:**
546+
- `filename` (str): Path to inventory CSV file
547+
548+
**Returns:**
549+
- Dictionary with keys:
550+
- `"total_products"` (int): Total number of products
551+
- `"critical_count"` (int): Number of critical items
552+
- `"critical_products"` (set): Set of critical product names
553+
554+
**Example:**
555+
```python
556+
result = critical_inventory("data/inventory.csv")
557+
print(result)
558+
# {
559+
# "total_products": 50,
560+
# "critical_count": 7,
561+
# "critical_products": {"Laptop_X1", "Monitor_Pro", "Keyboard_Mech", ...}
562+
# }
563+
```
564+
565+
---
566+
567+
## Exercise 7: Employee Promotion Candidates <Badge type="warning" text="Task" />
568+
569+
Navigate to `/labs/lab09/exercise7/exercise7.py`.
570+
571+
**Background:**
572+
573+
The HR department is preparing for the annual promotion cycle. To be considered for promotion, employees must have both strong performance (above company average) and sufficient experience (at least 2 years with the company). HR needs to know who qualifies.
574+
575+
**Task:**
576+
577+
Write a function `promotion_candidates(filename)` that determines which employees meet the promotion criteria and returns the company's average performance score, the experience requirement, how many employees qualify, and their names
578+
579+
**Parameters:**
580+
- `filename` (str): Path to employee CSV file
581+
582+
**Returns:**
583+
- Dictionary with keys:
584+
- `"average_performance"` (float): Company average performance (rounded to 1 decimal)
585+
- `"min_years_required"` (int): Minimum years required (always 2)
586+
- `"candidate_count"` (int): Number of qualified candidates
587+
- `"candidate_names"` (set): Set of candidate names
588+
589+
**Example:**
590+
```python
591+
result = promotion_candidates("data/employees.csv")
592+
print(result)
593+
# {
594+
# "average_performance": 78.5,
595+
# "min_years_required": 2,
596+
# "candidate_count": 12,
597+
# "candidate_names": {"John Smith", "Sarah Lee", "Michael Chen", ...}
598+
# }
599+
```
600+
601+
---
602+
603+
## Exercise 8: Maximum Scores by Subject <Badge type="warning" text="Task" />
604+
605+
Navigate to `/labs/lab09/exercise8/exercise8.py`.
606+
607+
**Background:**
608+
609+
A school administrator wants to visualize the highest achievement in each subject (Math, Science, English, Physics, Chemistry) to understand which subjects have the strongest top performers. This will help identify where advanced programs are most successful.
610+
611+
**Task:**
612+
613+
Write a function `plot_subject_maximums(filename)` that creates a line chart showing the peak performance in each subject. The chart should display subjects on the horizontal axis and their maximum scores on the vertical axis, with points marked on the line. Return the total number of students analyzed
614+
615+
**Example:**
616+
```python
617+
count = plot_subject_maximums("data/students.csv")
618+
# Chart window appears showing line plot of maximum scores
619+
print(count) # 25
620+
```
621+
622+
**Chart Requirements:**
623+
- x-axis label: "Subject"
624+
- y-axis label: "Maximum Score"
625+
- Title: "Maximum Scores by Subject"
626+
- Use `marker='o'` to show points on line
627+
628+
---
629+
630+
## Exercise 9: Subject Distribution Comparison <Badge type="warning" text="Task" />
631+
632+
Navigate to `/labs/lab09/exercise9/exercise9.py`.
633+
634+
**Background:**
635+
636+
The curriculum committee wants to compare how scores are spread across Math, Science, and English. By visualizing all three distributions on the same chart, they can identify which subjects show consistent performance versus which have wide variation in student achievement.
637+
638+
**Task:**
639+
640+
Write a function `compare_subject_distributions(filename)` that creates a histogram showing the score distribution for all three subjects on one chart. Make the distributions transparent so they can be compared visually, and include a legend to identify each subject. Return the total number of students analyzed
641+
642+
**Example:**
643+
```python
644+
count = compare_subject_distributions("data/students.csv")
645+
# Chart window appears showing overlapping histograms
646+
print(count) # 25
647+
```
648+
649+
**Chart Requirements:**
650+
- All histograms: bins=10, alpha=0.5
651+
- Labels: "Math", "Science", "English"
652+
- x-axis label: "Score"
653+
- y-axis label: "Frequency"
654+
- Title: "Score Distribution Comparison"
655+
- Must include `plt.legend()`
656+
657+
---
658+
501659
## Commit and Push Your Work
502660

503661
After completing all exercises, save all your files and commit them to your repository.

0 commit comments

Comments
 (0)