I need to write a function of the first n square numbers, The sequence of squares start with 1, 4, 9, 16, 25.
For example if the input is 16, the output will be
[1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256]
This code is what I've tried, but its completely wrong. This code counts my number from 1 to 255. I have no idea what to fix
def squares(n):
L = list(range(n**2))
L = [num for num in L if num]
return L