my_list=[1,2,3,4,5]
new_list=[]
for i in range(len(my_list)):
new_list.insert(i,my_list[-1])
my_list.pop(-1)
I used the above code to reverse a list but I was wondering why is the range(len(my_list)) necessary, more specifically, why doesn't it work if I simply put "for i in my_list:"?