Home Blog Python Notes

Reverse the array

Published:


	Sample Input

	4
	1 4 3 2
	Sample Output

	2 3 4 1

	#!/bin/python3

	import sys


	n = int(input().strip())
	arr = [int(arr_temp) for arr_temp in input().strip().split(' ')]

	import re

	arr.reverse()
	print (re.sub(",|\[|\]", "", str(arr)))
Comment