medium
Python Code Optimization
Refactor a Python code snippet to improve performance and readability.
📝 Contenu du Prompt
Review the following Python code snippet. Identify areas for optimization regarding time complexity and readability. Refactor the code to follow PEP 8 standards and add docstrings. Explain the changes made and why they improve the code.