Construct a list of first 100 natural numbers.Create a two dimensional array with 10
rows and whose each row contains 10 columns and each number in this array is the
square of the number from your constructed list.
For example : [[1,4,9,...,100],[121,144,...],......,
# Create a list of first 100 natural numbers
L = list(range(1,101))
# Create a two dimentional array 10x10
array = [[0]*10 for i in range(10)]
# fill the array by squared numbers from the list
for i in range(len(L)):
row = i // 10
col = i % 10
array[row][col] = L[i]*L[i]
print(array)
Comments
Leave a comment