medium
Convert Loop to List Comprehension
Optimize Python code by converting a standard for-loop into a list comprehension for filtering and squaring numbers.
📝 プロンプトの内容
I have a Python for loop that iterates through a list of integers and creates a new list containing only the even numbers squared. Rewrite this code using list comprehension for better efficiency and readability.