Count User Events from JSON Activity Logs
Beginner Mode
Start your terminal to use beginner mode.
Scenario
A JSON file contains user activity logs with various events. You need to analyze the logs and generate a report showing how many events each user performed.
Task
Write a Python script at /home/interview/count_events.py that reads /home/interview/activity_logs.json, counts the number of events per user, and saves the results as a JSON file to /home/interview/user_event_counts.json.
Example
Expected output format in /home/interview/user_event_counts.json:
{
"user_123": 5,
"user_456": 12,
"user_789": 3
}
Terminal requires a larger screen
Open this page on a desktop or tablet (≥ 768px) to launch the terminal and practice hands-on.
Linux Terminal Environment
Write and execute your solution in the terminal below.
Track
| Question | Difficulty | Company | Access |
|---|
Need more practice in this area? Explore more questions →
Uber