Your question is Extract Error Codes from 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.
Given a list of log lines logs and a target severity string level, return all error codes that appear in lines matching that severity. A valid code appears as CODE=<value> where <value> consists of uppercase letters, digits, or underscores. Return each matching code once, in the order it is first found.
def extract_error_codes(logs, level):