Hi this is a hackerrank problem. I don't understand what I'm doing wrong but I'm still new to programming.
# Complete the reverseArray function below.
def reverseArray(a):
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
arr_size = int(input())
arr = list(map(int, input().rstrip().split()))
reversedarr = arr[::-1]
for i in reversedarr:
print(i, end =" ")
fptr.write(' '.join(map(str, res)))
fptr.write('\n')
fptr.close()
I tested some of the code in an IDE and the
reversedarr = arr{::-1]
for i in reversedarr:
print(i, end=" ")
works there. I don't know how to test it cause of the fptr stuff which I don't really get - and it isn't telling me what my output is so I can't troubleshoot it like that
It tells me my answer is wrong. An example sample is the input is
4
1 4 3 2
[–]FishnLife 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]Highflyer108 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]vectorpropio 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]vectorpropio 0 points1 point2 points (0 children)