Tuesday, October 7, 2025
HomeLanguagesPython False Keyword

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.

Python3




# 10 < 6 is a boolean expression
# which evaluates to False
if(10 < 6):
    print("it is True")
else:
    print("it is False")
  
# here we directly assigned False
# keyword to if statement
if(False):
    print("it is True")
else:
    print("it is False")


Output

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 False
gfg_flag = 5 > 10
  
# printing the variable value
print(gfg_flag)
  
# now we will be using this variable
if(gfg_flag):
    print("it is True")
else:
    print("it is False")


Output

False
it is False
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32340 POSTS0 COMMENTS
Milvus
86 POSTS0 COMMENTS
Nango Kala
6708 POSTS0 COMMENTS
Nicole Veronica
11872 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11936 POSTS0 COMMENTS
Shaida Kate Naidoo
6829 POSTS0 COMMENTS
Ted Musemwa
7090 POSTS0 COMMENTS
Thapelo Manthata
6780 POSTS0 COMMENTS
Umr Jansen
6784 POSTS0 COMMENTS