Thursday , February 22 2018
Home / Python / Python if statement Example

Python if statement Example

The Python if statement is also similar like java, php simple if statements and etc.,

Python if statement :

Python if is a simple conditional statement which executes the block of statements if the condition returns True otherwise it skips the execution of the block.

Syntax :

if condition : statement


if condition :

    statement 1

    statement 2

Example :

name = input('Enter your name .. ')
if name == 'chandra' :


$ python3
Enter your name ..chandra
Hi chandra
$ python3
Enter your name ..shekhar


Happy Learning 🙂

About chandrashekhar

Hi Folks, you have reach this so far, that shows you like what you are learning. Then why don't you support us to improve for bettor tutorials by leaving your valuable comments and why not you keep in touch with us for latest updates on your favorite blog @ facebook , twitter , Or Google+ ,


Convert any Number to Python Binary Number

We have discussed in the previous tutorials, how to handle different types of number systems …

Leave a Reply

Your email address will not be published. Required fields are marked *