Saved Bookmarks
| 1. |
if array A has elements (1,2,3),then revers of the array A will be (3,2,1),and the resultant array should be (4,4,4) |
|
Answer» # Defining a function to reverse elements of a list/array def Reverse(LST): return [ele for ele in reversed(lst)]
# DRIVER Code lst = [1,2,3] # Applying Reverse function on the list reverse_lst = Reverse(lst) # Creating a final list and applying a lambda function to sum both the above lists final_lst = [sum(x) for x in zip(lst, reverse_lst)] # Printing the Final List print(final_lst) Explanation: The code written above is in python language. |
|