so I have been trying to find out how can I reverse a given array
input :
y = []
x = [1 , 2, 3, 4, 5, 6 ]
for i in x :
j = x[-1]
j -= x[-1]
y.append(j)
print(y)
output :
[0, 0, 0, 0, 0, 0]
why am I getting this as output.
and how should I code this ?
New contributor
mehak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.