[Python] python reduce to check if all elements are equal

Discussão em 'Python' iniciado por Stack, Dezembro 1, 2024.

  1. Stack

    Stack Membro Participativo

    Suppose a = [[1,2,3],[1,2,3]] reduce(lambda x,y: x==y, a) returns True

    But if a = [[1,2,3],[1,2,3],[1,2,3]] reduce(lambda x,y: x==y, a) returns False

    Why in the second case, the outcome is False?

    please help

    thanks

    Continue reading...

Compartilhe esta Página