My task is to create an empty array and take the input from the user, but I have to print the input element in a reversed order without the function, that too in an array itself.
x=int(input('how many cars do you have'))
a=[]
for i in range(x):
car=(input('enter your car name'))
a.append(car)
print(a)
y=[]
for i in range(length(a)-1,-1,-1):
y.append(a[i])
print (y)
Why am i getting repeated reverse array output with this code. Can anyone please tell me what's wrong in this
