You can learn about Control Statements in Python Programs with Outputs helped you to understand the language better.

Python Programming – Conditional Statements

When the program uses a condition to decide which set of statements is to be executed between two alternative set of statements is called conditional statements. For example,
“If it is cold then put your coat on.”
In the above statement, the resultant action is taken if the condition is evaluated to true (i.e., the weather is cold).
The conditions could be multiple, as in the following conversation:

“Ok then, if I come back early from work, I will see you tonight; else if it is too late I will make it tomorrow; else if my brother arrives tomorrow we can get together on Tuesday; else if Tuesday is a holiday, then let it be Wednesday; else I will call you to arrange for the next meeting 1”.

Python Programming - Conditional Statements chapter 5 img 3

Python programs can handle such chained conditions as long as you write the appropriate code. In Python, there are many control structures that are used to handle conditions and resultant decisions. In this chapter, you will be introduced to more powerful tools, namely, the if,.else, while, and for constructs. But before developing the solution to a problem, you need to decide on different tools, used to solve the problem. If efficient programming tools are used, tasks are effectively performed. We code some instructions to instruct computers for problem-solving purposes. The choice of tools depends on the nature of the problems.

  • A Program is a set of instructions, written in a computer language, to perform a specific task.

Leave a Reply

Your email address will not be published. Required fields are marked *