negation of boolean in pyhton code example

Example 1: negation of boolean in pyhton

# Return opposite of boolean
bool_value = True
print (bool_value) # True
bool_value = not bool_value
print (bool_value) # False

Example 2: negation of boolean in pyhton

# Return opposite of boolean
bool_value = True
print (bool_value) # True
bool_value = not bool_value
print (bool_value) # False

Example 3: negation of boolean in pyhton

# The negation of a boolean is the opposite of its current value
x = True
print (x) # output True
x = not x
print (x) # output # False