Two-Level Counting With countplot and hue
The Ravensworth Group's headcount file lists one line per employee: their department and their status. The chart tallies employees per department and splits each department's bar by status, so the mix inside a department is visible rather than just its size. HR's covering note quotes one figure from that chart.
Task: Print how many employees are in department Sales and have status Active.
Input
The first line holds one integer n, the number of employees, where 1 <= n <= 1000. Then come n lines, each holding a department name and a status separated by a single space. Neither contains spaces, and either may be absent from the file entirely.
Output
One line holding a whole number: how many lines carry Sales in the department field and Active in the status field. Both have to match on the same line. Print 0 if none do.
Example:
Input:
4
Sales Active
Sales Inactive
Sales Active
HR Active
Output:
2
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in