The program creates an empty list called "l" and then uses a for loop to iterate through the range of numbers from 11 to 25 (not including 25). For each number in the range, the program raises it to the power of 2 and appends the result to the "l" list.
After the for loop completes, the program then prints out the first 5 elements of the "l" list using list slicing. The syntax "l[:5]" means to return the first 5 elements of the list. Then the program prints the last 5 elements of the "l" list using list slicing. The syntax "l[-5:]" means to return the last 5 elements of the list.
l = list() for i in range(11,25): l.append(i**2) print(l[:5]) print(l[-5:])
[121, 144, 169, 196, 225] [400, 441, 484, 529, 576]
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions