Reverse List
Python
Easy
2 views
Problem Description
Read n integers. Output them in reverse order.
Input Format
First line n. Second line n integers.
Output Format
One line reversed list.
Official Solution
import sys
p=sys.stdin.read().strip().split()
if not p: sys.exit(0)
n=int(p[0])
a=p[1:1+n]
a.reverse()
sys.stdout.write(' '.join(a))
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!