Logical operation between two Boolean lists

前端 未结 7 810
终归单人心
终归单人心 2021-02-07 15:42

I get a weird result and I try to apply the and or the or operator to 2 Boolean lists in python. I actually get the exact opposite of what I was expec

7条回答
  •  失恋的感觉
    2021-02-07 16:00

    Мore functional:

    from operator import or_, and_
    from itertools import starmap
    
    a = [True, False, False]
    b = [True, True, False]
    starmap(or_, zip(a,b))  # [True, True, False]
    starmap(and_, zip(a,b))  # [True, False, False]
    

提交回复
热议问题