Decision Making Statements In Python Programming Language

Decision Making In Python Programming Language

In this article, we will learn all about decision making in Python. By decision making it means we set some kind of logical conditions in our code to be executed and only when these conditions fulfill the program will take specified action otherwise it didn’t work.

These decision-making statements normally provide results in the form of TRUE or FALSE according to the conditions we had specified before. You also need to specify which action should be performed in case of a result to be TRUE or FALSE.

We can represent these decision statements in graphical form as follows and these graphical working model almost the same in every programming language.

As you can see above the very first thing is the condition specified by us. Based on our specified condition the result will be TRUE or FALSE and after this, appropriate action will be performed accordingly. After all this cycle the statement will be terminated.

Recommended:  Global, Local And Nonlocal Variables In Python Programming

Any value that is non-zero or non-null will be considered as TRUE or positive value by Python programming language for his operations and on the other hand, any zero or null value will be considered as FALSE or negative value by Python programming language.

Like any programming language in Python programming language also provides the following decision making statements to complete their operation based on given conditions. All the decision-making statements are given below with a complete explanation. Just click the links below to learn about all these statements.

Sr. No.Decision Making Statement
1.if statement
This statement is based on one boolean expression which can be True or False.
2.if.elif..else statements
This kind of if statement have an optional additional part as else. It will only execute when the boolean expression is False.
3.nested if statements
This is a kind of statement in which you can use one if or else statement inside of another if or else statement.
Recommended:  How To Make Basic Calculator Using Python Programming Langauge

Jack Sparrow

Hay I Am Admin Of This Website. I Am Very Passionate About Computers And Technology. This Website Is The Result Of My Passion. I Love To Eliminate The Barriers That Come In Seeking Education. This Website Is The Free Source Of Learning About New Technology And Up To Date Knowledge.

Leave a Reply