Home >>Python Keywords >Python if Keyword

Python if Keyword

Python if Keyword

Python if keyword in python is used to define a conditional statement (if statements), and executes a block of code, if a given condition is true. This keyword is used with the various type of if-else conditional statements.

Here is an example of Python if Keyword:

a = 10
if a > 8:
print("YES")

Output:
YES
Example 2:

b = 15
if b > 10:
  print("YES")
else:
  print("NO")

Output:
NO