Hey there fellow programmers, I want to check the equality of list elements in a recursive way. The following code snipped should fulfill this task but I might have misunderstood something. If I test the function are_numbers_equal([2, 2, 2, 2]) I get False and not True. I would be thankful for help! Much love <3
The code:
def are_numbers_equal(self, numbers):
if len(numbers) > 1:
return numbers.pop() == self.are_numbers_equal(numbers)
else:
return numbers.pop()