You are viewing a single comment's thread. Return to all comments →
i think you forgot about number of digits to print (N)
Not necessary. I just take whatever comes as the second input, create a list from it, reverse it and print the elements glued with a space.
You can do it in a single line:
print(input()==0 or " ".join(input().split()[::-1]))
Your code didn't work.
>> print(input()==0 or " ".join(input().split()[::-1]))
10 20 30 40
I guess that you forgot to press Enter after the first integer input.