Python False

Contents

Python False

Python False is a keyword used to represent the logical/boolean value of false or 0.

Since, False represents one of the two boolean values, which is returned by boolean expressions, or conditions when the expression/condition evaluates to logically false value.

Examples

For example, in the following example, we take a boolean expression 1 == 3, which always evaluates to logical false. We have assigned this expression to variable x, and print the result to standard output.

Python Program

x = 1 == 3
print(x)
Run Code Copy

Output

False

Assign False to variable

We can assign a value of False to a variable. In the following program, we have assigned the value False to variable x.

Python Program

x = False
print(x)
Run Code Copy

Output

False

Function returns False

Since, it is a value, we can return False from a function, always or during specific conditions.

Python Program

def alwaysFalse():
    return False

x = alwaysFalse()
print(x)
Run Code Copy

Output

False

Summary

In this tutorial of Python Examples, we learned what False keyword is in Python programming, and how to use it under different circumstances.

Related Tutorials

Code copied to clipboard successfully 👍