Your question is Aggregate Error Codes by Timestamp. 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.
Given a list of log lines logs and a list of target error codes target_codes, write a function that parses each line and returns a mapping from timestamp to error-code counts. Each valid log line has the format TIMESTAMP|LEVEL|CODE|MESSAGE. Only count lines whose CODE is in target_codes. Ignore malformed lines.
|def aggregate_error_codes(logs, target_codes):