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


Python If statement flow chart


Python If Statement Example

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


Hello User