Q. If you are asked to label the Python loops as determinable or non-determinable, which label would you give to which loop? Justify your answer.
Answer =
The 'for loop' can be labelled as determinable loop as number of its iterations can be determined beforehand as the size of the sequence, it is operating upon.
The 'while loop' can be labelled as non-determinable loop, as its number of iterations cannot be determined beforehand. Its iterations depend upon the result of a test-condition, which cannot be determined beforehand.
The 'while loop' can be labelled as non-determinable loop, as its number of iterations cannot be determined beforehand. Its iterations depend upon the result of a test-condition, which cannot be determined beforehand.
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )