Your question is Parse and Count Error Codes. 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 entries as strings, write a function that extracts every error code and returns a formatted summary of code frequencies. A valid error code appears either as ERROR_<digits> anywhere in the line or inside a JSON fragment as "error_code":"ERROR_<digits>". Return a list of strings formatted as "ERROR_404: 3", sorted by descending frequency and then lexicographically by code.
ERROR_<digits>def summarize_error_codes(logs):