7: Array data structure

                                     Array data structure


Task
Given an array, , of  integers, print 's elements in reverse order as a single line of space-separated numbers.

Input Format

The first line contains an integer,  (the size of our array).
The second line contains  space-separated integers describing array 's elements.

Constraints

  • , where  is the  integer in the array.

Output Format

Print the elements of array  in reverse order as a single line of space-separated numbers.


solution:

import math
import os
import random
import re
import sys



if __name__ == '__main__':
    n = int(input())

    arr = list(map(intinput().rstrip().split()))
r = map(str, arr[::-1])
print(" ".join(r))


Comments

Popular posts from this blog

15: Linked List(python)