Thursday, May 16, 2019

How to control the flow of program in python

Python If-else Statement
If-else statement is a decision making statement that allow us to run a particular block of code for a particular decision. Making decision is the most important features of all programming language.


If Statement
If statement is used to check, whether the condition is true or false. If the condition is true the program execute the true statement and if it is false the program show the final result.



For Example:



OUTPUT







If-else Statement
In if-else statement, one else block is added with if statement. If the condition is true, if statement will execute otherwise the else statement will execute.



For Example: program to check whether a person is eligible to vote or not



OUTPUT






Click Here to know more about Python





No comments:

Post a Comment

How to control the flow of program in python

Python If-else Statement If-else statement is a decision making statement that allow us to run a particular block of code for a particula...