Python if

Python if

The Python if statement is a statement which is used to test specified condition. We can use if statement to perform conditional operations in our Python application.

The if statement executes only when specified condition is true. We can pass any valid expression into the if parentheses.

There are various types of if statements in Python.

  • if statement
  • if-else statement
  • nested if statement

Python If Statement Syntax

if(condition):
   statements

Python If statement flow chart

 

Python If Statement Example

a=10
if a==10:
        print  "Welcome to javatpoint"

Output:

Hello User