Medium
Refactor Loop to List Comprehension
Optimize Python code by converting a standard for-loop into a list comprehension.
📝 Contenido del prompt
Refactor the following Python code snippet to use a list comprehension for better readability and performance: 'squared_numbers = []; for x in range(10): if x % 2 == 0: squared_numbers.append(x**2)'