Medium
Code Optimization for Python
Refactor a Python list processing loop for efficiency.
📝 Contenu du Prompt
Review the following Python code snippet which iterates through a list of dictionaries to find a specific key. Suggest a more efficient, 'Pythonic' way to write this using list comprehensions or the filter function: [code snippet: result = []; for item in data: if item['active']: result.append(item)].