intermediate
Refactor Python Loop
Improve the efficiency and readability of a specific Python code snippet.
📝 Prompt-Inhalt
Refactor the following Python code to use list comprehension instead of a for loop: squares = [] for x in range(10): squares.append(x**2)