Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Parse User Action Logs

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Parse User Action Logs. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Write a function that parses user action logs.

Implement parse_user_action_logs(logs). Each element of logs is a valid comma-separated string in the format user_id,action,timestamp, where timestamp is an integer. Return a list of dictionaries containing user_id, action, and integer timestamp, in the same order as the input. User IDs and actions do not contain commas. An empty input should return an empty list.

Constraints

  • 0 <= len(logs) <= 10^4
  • Each log contains exactly three comma-separated fields
  • Each timestamp is a valid integer
  • User IDs and actions do not contain commas
  • The output preserves input order

Function Signature

def parse_user_action_logs(logs):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output