Page 66 - Computer - 7
P. 66
1. Type the code as shown in the image in the Python Editor.
2. Press the F5 key to execute the code. Sample outputs of the program are given below.
Database Subject Enrichment
Python follows the concept of indentation of statements, a convention known as the off-side rule,
a term coined by British computer scientist Peter J. Landin. The term is taken from the offside law in
football. Languages that adhere to the off-side rule define blocks by indentation. The tactic used by
most programming languages is to designate special tokens that mark the start and end of a block.
For example, in C++, blocks are defined with pairs of curly braces ( { } )
Post-Processing
Decision-making is the process of evaluating a given condition and deciding the course of action
to follow based on the result of the condition.
The statements that let us take decisions based on conditions in a Python program are called
Conditional statements.
Conditional statements in Python include the If statement, the If … Else statement, the Nested
If … Else statement, and the If … Elif … Else ladder.
Indentation of statements helps in structuring the program in an organised manner and
visualising the different blocks of statements easily.
64