Intermediate
Refactor Code Explanation
Suggest improvements for a coding logic to increase efficiency and readability.
📝 Contenuto del prompt
Review the following Python function that checks for prime numbers. Suggest optimizations to improve its time complexity and readability. Explain your changes step-by-step.