Ad

a bit shorter version (but slighly slower)

Code
Diff
  • def solution(p):
        return (r := 0b11) and [(r := (r >> (_ is True))) for _ in p] and not r
    • def solution(p):
    • r = 0b11
    • for _ in p:
    • if _ is True:
    • r >>= 0b1
    • return not r
    • return (r := 0b11) and [(r := (r >> (_ is True))) for _ in p] and not r

i just like bitwise operations.

ps. this is the fastest solution i found, even though it's not the shortest one.

Code
Diff
  • def solution(p):
        r = 0b11
        for _ in p:
            if _ is True:
                r >>= 0b1
        return not r
    • def solution(p):
    • return sum(1 for val in p if isinstance(val, bool) and val) >= 2
    • def solution(p):
    • r = 0b11
    • for _ in p:
    • if _ is True:
    • r >>= 0b1
    • return not r