Take as input N, a number. Take N more inputs and store that in an array. Write a recursive function which inverses the array. Print the values of inverted array
Input Format
Enter a number N and take N more inputs
Constraints
None
Output Format
Display the values of the inverted array in a space separated manner
Sample Input
4 1 0 2 3
Sample Output
1 0 2 3
my logic:
n = int(input())
ns = [ ]
for i in range(n):
nn = int(input())
ns.append(nn)
v = []
def inv(arr):
v.append(arr.pop())
if arr:
inv(arr)
else:
for i in v:
print(i, end=" ")
inv(ns)
*
What is wrong here?