What are you trying to calculate?

Also, why are you using any and all?

Both those functions work with multiple values and you only seem to be comparing single values on each iteration.