Your question is Python Data Manipulation. 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.
The Figma Design team receives engagement summaries for component variants from multiple experiments. Because several records may describe the same component and variant, combine duplicates and rank each variant by its engagement rate.
Implement summarize_component_engagement(records).
records is a list of dictionaries. Each dictionary contains string fields component and variant, plus non-negative integer fields views and interactions.views and interactions for records with the same (component, variant) pair.total_interactions / total_views. If total views are zero, the rate is 0.0.component, variant, views, interactions, and engagement_rate.engagement_rate to four decimal places in the returned output.component ascending, and finally variant ascending.def summarize_component_engagement(records):