medium
Python Code Optimization
Refactor a Python code snippet to improve performance and readability.
📝 প্রম্পট বিষয়বস্তু
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.