Revision: 70665
Updated Code
at June 3, 2016 03:52 by denisemauldin
Updated Code
#!/bin/python3 import sys n = int(input().strip()) arr = [int(arr_temp) for arr_temp in input().strip().split(' ')] print(" ".join(str(x) for x in arr[::-1])) print(" ".join(map(str, arr[::-1]))) # or print(' '.join(map(str, reversed(arr)))) # or
Revision: 70664
Updated Code
at June 3, 2016 03:51 by denisemauldin
Updated Code
#!/bin/python3 import sys n = int(input().strip()) arr = [int(arr_temp) for arr_temp in input().strip().split(' ')] print(" ".join(str(x) for x in arr[::-1])) print(" ".join(map(str, arr[::-1])))
Revision: 70663
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 3, 2016 03:46 by denisemauldin
Initial Code
#!/bin/python3 import sys n = int(input().strip()) arr = [int(arr_temp) for arr_temp in input().strip().split(' ')] print(" ".join(str(x) for x in arr[::-1]))
Initial URL
Initial Description
arr[::-1] does a list slice to reverse the array str(x) for x in arr[::-1] casts the ints in the array as strings map(str, arr[::-1]) does the same thing by using map to cast the ints " ".join() joins the resulting strings with a space
Initial Title
Python Reverse Array
Initial Tags
python, array
Initial Language
Python