write a python function Square_List(A) that takes a list as an input and returns another list of lists that has the first number as the same number given in the input list and the second number be the square of the first number.[[1, 1], [2, 4], [5, 25], [6, 36]]
def Square_List(A):
rez_list = [[0] * 2 for i in range(len(A))]
for i in range(len(A)):
rez_list[i][0] = A[i]
rez_list[i][1] = A[i] ** 2
return rez_list
print("Enter the list separated by a space:")
a = input().split()
for i in range(len(a)):
a[i] = int(a[i])
print(Square_List(a))
Comments
Leave a comment