Your question is Normalize and Filter Event Records. 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 an array of event record strings records, implement a Python function that returns a new array containing only valid transformed records. Each input string has the form "key:value". A record is valid if it contains exactly one colon, the key is non-empty after trimming spaces, and the value is non-empty after trimming spaces. For each valid record, return it as "KEY=value", where the key is uppercased and duplicate keys keep only their last valid value while preserving the key's first appearance order.
def transform_records(records):