I know this code is messy, but it is returning the correct answer. So why is it being marked wrong?
#Write your function here
def reversed_list(lst1, lst2):
new1 = 
for i in range(len(lst1)):
if i > 0:
return new1 == lst2
#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]))
Are you getting an error message? If so, what is it exactly?
Edit: I reset the exercise, and ran your code. I believe you likely received an ‘index out of range’ error. It appears that the SCT tests your code with empty lists:
print(reversed_list(,). Your code does throw an error in that case due to this line:
lst1 is empty,
lst1 doesn’t exist, and is therefore out of range.
Hey thanks that actually makes sense to me! I appreciate it.