Python Decision Making


Decision-making is the expectancy of terms that happen while execution of the program and stipulate actions taken following the conditions.

Decision designs measure multiple expressions that supply TRUE or FALSE as the outcome. You require finding which action to take and which statements to execute if the outcome is TRUE or FALSE otherwise.

Following is the broad form of a typical decision devising structure found in most of the programming languages −

python decision making

Python programming language is designed to for handling any non-zero and non-null values depicting as TRUE. In case, the value is neither zero nor null, then it is value delivered is FALSE value.

Python programming language is believed to apply the providing types of decision-making statements. Click the following links to check their detail.


Statement & Description


if statements

An if statement consists of a boolean expression followed by one or more statements.


if...else statements

An if statement can be followed by an optional else statement, which executes when the boolean expression is FALSE.


nested if statements

You can use one if or else if statement inside another if or else if statement(s).

Let us go through each decision making briefly:

Single Statement Suites

If the suite of if clause comprises of an individual or say a single line, then, such cases might go on the similar line constructing as the header statement.

Here is an example of a one-line if clause:


var = 100
if ( var == 100 ) : print "Value of expression is 100"
print "Good bye!"

Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.