Hello, I have written the below code to try and answer one of the python challenges for checking if a list reversed is the same as another list. I have ended up trying to do it a completely different method to what the way to do it example was. I’m just wondering if it is actually possible to do how i have attempted to do it?
I am trying to make a new list that is the reverse of list 1 and then compare the indices of each list to see if they are the same. On both of the reversed lists i get a false though which obviously the first should be true
#Write your function here
def reversed_list(lst1, lst2):
reverse1 = []
reverse1.append(lst1.reverse())
for i in range(len(lst1)):
if reverse1[i] == lst2[i]:
return True
else:
return False
#Uncomment the lines below when your function is done
print(reversed_list([1, 2, 3], [3, 2, 1]))
print(reversed_list([1, 5, 3], [3, 2, 1]))