Could I make a list determining if they match?

I created an empty list in which i could store every True value. This would add a True value to that list (line 7) every time there was a match. In line 8 I compared the length of the list with the counted amount of True’s. This would then return True if every comparison was a match and False otherwise.
Is there any weak point in this code? I am wondering because it differs from the original solution

Counting the amount of matches will cause it to ignore where the matches are, won’t it? You’d for example get the result that [1, 2] is the reverse of [1, 2] which it isn’t, due to having the same elements.
[1, 1] is also the reverse of [1, 1] but your function probably says that it’s not due to the number of matches being 4
Also seems like far too many comparisons. How many comparisons should be made with regard to the size of the input?

Whether it matches the “solution” is kind of irrelevant. Is it doing the right thing? Would you be doing those things if you did it manually? What is the right thing to do? Ask yourself what should happen and refer to that when you write the code.

2 Likes

Thanks for the comments. I thought this code would result in the same output that was give as the original solution. I was struggling with the exercise which resulted in me trying another approach. I think I tried too hard to make the example lists fit the code that I lost sight of the bigger picture. Thanks anyways :+1: