Middle+
Calculate the squares of numbers from 0 to 9 in one line.
sobes.tech AI
Answer from AI
python squares = [x**2 for x in range(10)] print(squares)
This one-liner creates a list of squares of numbers from 0 to 9 using list comprehension in Python.