Calculation list , And the result is the following list :[1,4,9,16,25,36,49,64,81,100]
1、 Through the list analysis, we can know : Each element corresponds to 1-10 The square value of
2、 So by traversing 1-10 Value , Then calculate the square
3、 Generation format is list , You can use the list generation formula directly
4、 Because the value range includes the head but not the tail , So it is range(1,11)
The code is as follows ( Example ):
l = [i*i for i in range(1,11)]
print(l)
Return results :
[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]