Shares
facebook sharing button Share
twitter sharing button Tweet
email sharing button Email
linkedin sharing button Share
reddit sharing button Share
tumblr sharing button Share
blogger sharing button Share
print sharing button Print
skype sharing button Share
sms sharing button Share
whatsapp sharing button Share
arrow_left sharing button
arrow_right sharing button
 Krivalar Tutorials 
Krivalar Tutorials

Python - if else Statemment



<if    if elif >







if else statement is another form of an if statement. The else statement is an optional one and must follow the if conditional statement. There are two possibilities in which one possibility will be executed based on the condition check.

Flow Chart



Syntax of Python if... else

Following is the basic syntax of the if...else decission control flow statement.

if(expression):
	statement_1
else:
	statement_2

Example with if...else in Python

Below is an example proram to check the given number is even or odd.

A = int(input('enter the value to check: '))

if((A%2)==0):
	print('The value A is Even')
else:
	print('The value A is Odd')

While executing above program you will get the following output.

F:\>python even.py
enter the value to check: 45
The value A is Odd

For another input:

F:\>python even.py
enter the value to check: 70
The value A is Even

<if    if elif >





















Searching using Binary Search Tree