If Else Statement In Python

Introduction

In this blog, I am going to explain about the If Else statement in Python. The output will be displayed in the Run module. If the condition is correct,  it will display the output in the true statement.

Software Requirement

Python 3.5.2.

Simple Programming

  1. print("welcome To C#Corner.....")   
  2. print("If Else Statements :")   
  3.   
  4. age=input("Enter Your Age :")   
  5.   
  6. if int(age)>=18:   
  7. print("You Are Eligiable For Voting.....")   
  8. else :   
  9. print("You Are Not Eligiable For Voting...")   
Explanation

In this blog, the output will be displayed as the correct condition, when the number is less than 18. It will display the second condition, when it is above 18:

Output

welcome To C#Corner.....

If Else Statements

Enter Your Age :21
You Are Eligiable For Voting.....
>>>
== RESTART: C:/Users/admn/AppData/Local/Programs/Python/Python35/ifelse.py ==
welcome To C#Corner.....

If Else Statements

Enter Your Age :16
You Are Not Eligiable For Voting...
>>>

 

Ebook Download
View all
Learn
View all