You are viewing a single comment's thread. Return to all comments →
I did something similar, every time I tried to print x in the for loop I was getting a vertical output, so I made it a string.
*Edit: I copy and pasted your code, and didn't pass due to having the vertical output. Did it work for you?
This passed for me.
n = int(input().strip())
arr = [int(arr_temp) for arr_temp in input().strip().split(' ')]
c = ""
for x in arr[::-1]:
c += str(x) + " "
Yes man, worked! Please try again and let me know. Did you try here? or in your terminal?
Ahh, it works in python 2, but not in 3. Good work, it's very simple.
In python 3 you have just change the print fuction
for x in reversed(arr):
print(x, end=" ")
Awesome, thank you!