Reverse the array
Problem Statement
Suggest Edit
Problem Statement
The first line contains an integer N representing the size of the array.
The second line contains N space-separated integers representing the elements of the array.
The only line of the output prints N space-separated integers representing the Reversed array elements.
1 <= N <= 10^3
1 <= arr[i] <= 10^9
1 <= K < N
8
7 5 2 11 2 43 1 10
10 1 43 2 11 2 5 7
Here the elements have been reversed.#Your code goes here. input() lst=input().split() lst=lst[::-1] str="" for i in lst: str+=i str+=' ' print(str)
Comments
Post a Comment