programming-examples/python/List/Python program to generate and print a list of first and last 5 elements where the values are square of numbers between 1 and 30 (both included).py
2019-11-15 12:59:38 +01:00

8 lines
155 B
Python

def printValues():
l = list()
for i in range(1,21):
l.append(i**2)
print(l[:5])
print(l[-5:])
printValues()