False keyword in python

Overview:

In Boolean logic "False" is a negative truth-value representing nothing.

Often represented as zero, several programming languages have a separate keyword and separate type to represent "False".

In Python, the type “bool” represents the Boolean values: "True" and "False".

A Boolean type does not hold any other value other than "True" and "False".

 

Example for "False" in Python:

 

switchOn = False

 

if(switchOn):

    print("The state of the switch is On")

else:

    print("The state of the switch is Off")

   

visibility = 0

 

#Convert zero to bool value using bool() function

print("Visibility is {}".format(bool(visibility)))

 

 

Python Output:

The state of the switch is Off

Visibility is False

 


Copyright 2024 © pythontic.com