Fetch data from an API and build a 2-dimensional list with some of the attributes, applying data transformations.
Asked in the first round stage. Python question in the Senior DE first round.
Implement build_attribute_matrix(records). The input is a decoded API response: a list of dictionaries containing id, displayName, status, and tags. Return one list per record in the original order, with columns [id, uppercase_display_name, active_flag, tag_count]. Strip surrounding whitespace from displayName, convert it to uppercase, map status "active" to True and every other status to False, and count the tags list.
def build_attribute_matrix(records):