How do I get the opposite (negation) of a Boolean in Python?

后端 未结 7 1504
太阳男子
太阳男子 2020-12-08 03:57

For the following sample:

def fuctionName(int, bool):
    if int in range(...):
        if bool == True:
            return False
        else:
            r         


        
7条回答
  •  无人及你
    2020-12-08 04:13

    Another way to achieve the same outcome, which I found useful for a pandas dataframe.

    As suggested below by mousetail:

    bool(1 - False)
    
    bool(1 - True)
    

提交回复
热议问题