Python False Keyword
A boolean expression results in two values(True, False) similar to this a boolean variable can also be assigned either (True, False). Here False keyword represents an expression that will result in not true.
Example 1 :
In this example first, we will give one boolean expression which will result in False (10 < 6). Next, we assigned the False keyword directly to the if statement.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
Python3
# 10 < 6 is a boolean expression# which evaluates to Falseif(10 < 6): print("it is True")else: print("it is False") # here we directly assigned False# keyword to if statementif(False): print("it is True")else: print("it is False") |
it is False it is False
Example 2 :
In this example, we will assign the boolean expression (5 > 10) to a variable gfg_flag then we will print the variable to show the value assigned to it which is False Keyword. Next, we will try to use this variable inside the if statement which will result in executing the else block.
Python3
# here we assigned the boolean expression to variable# and the value will be Falsegfg_flag = 5 > 10 # printing the variable valueprint(gfg_flag) # now we will be using this variableif(gfg_flag): print("it is True")else: print("it is False") |
False it is False


