SHARE
TWEET

Untitled

a guest Aug 20th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Task
  2. # Given an array, A, of N integers, print A's elements in reverse order as a single line of space-separated numbers.
  3.  
  4. # Input Format
  5. # The first line contains an integer, N (the size of our array).
  6. # The second line contains N space-separated integers describing array A's elements.
  7.  
  8. # Constraints
  9. # 1 <= N <= 1000
  10. # 1 <= Ai <= 10000, where Ai is the ith integer in the array
  11.  
  12. # Output Format
  13. # Print the elements of array A in reverse order as a single line of space-separated numbers.
  14.  
  15. #!/bin/python
  16.  
  17. import sys
  18.  
  19.  
  20. n = int(raw_input().strip())
  21. arr = map(int,raw_input().strip().split(' '))
  22.  
  23. a =  arr[::-1]
  24. print " ".join(str(x) for x in a)
  25. © 2019 GitHub, Inc.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top