How can I iterate over a list backward?

They are in situ operations, as in the happen in place.

Just as list.sort() has its counterpart, sorted(my_list), list.reverse() has its counterpart, reversed(my_list). the latter in each case return a new list, where the former are in place.

1 Like

This one worked for me:

def reversed_list(lst1, lst2):
  if lst1 == lst2[::-1]:
    return True
    return False