What is the need for selection and looping constructs?
Answers
Answered by
5
We can see that while looks like if statement. The statement begins with keyword while followed by Boolean condition followed by colon (:). What follows next is block of statement(s).
The statement(s) in BLOCK 1 keeps on executing till condition in while remains True; once the condition becomes False and if the else clause is written in while, then else will get executed.
Example: A loop to print nos. from 1 to 10
Similar questions
Music,
5 months ago
Math,
5 months ago
Hindi,
5 months ago
Political Science,
11 months ago
Art,
1 year ago