Advertisement



< Prev
Next >



Python Elif Statement




In Python, the elif statement consists of three parts:
Note: In many languages, an elif statement is known as the else-if statement.








Working of elif







Important points about conditional statements in Python





Advertisement




else if statement example


# Python - else-if statement example

if(99>100):
	print("99 is greater than 100")
elif(99<90):
	print("99 is less than 90")
print"(Statement not connected to elif statement")


Output


Statement not connected to elif statement




Program Analysis






elif statement with an optional else statement


# Python - elif statement with an optional else statement example

if(99>100):
	print("99 is greater than 100")
elif(99<90):
	print("99 is less than 90")
else:
	print("99 is greater than 90 and less than 100")
print"(Statement not connected to elif statement")


Output


99 is greater than 90 and less than 100
Statement not connected to elif statement




Program Analysis

Please Subscribe

Please subscribe to our social media channels for daily updates.


Decodejava Facebook Page  DecodeJava Twitter Page Decodejava Google+ Page




Advertisement



Notifications



Please check our latest addition

C#, PYTHON and DJANGO


Advertisement