Decision-making is the expectancy of terms that happen while execution of the program and stipulates 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 programming language is designed for handling any non-zero and non-null values depicting as TRUE. In case, the value is neither zero nor null, then is the value delivered is a FALSE value.
Python programming language is believed to apply the providing types of decision-making statements. Click the following links to check their detail.
Sr.No. | Statement & Description |
1 | An if statement consists of a boolean expression followed by one or more statements. |
2 | An if statement can be followed by an optional else statement, which executes when the boolean expression is FALSE. |
3 | 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:
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:
#!/usr/bin/python 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.