WGU D278 SECTION 4 TEST LATEST UPDATED
loop
a language construct that re-executes a series of instructions, the so-called loop
body, as long as the controlling expression evaluates to true; then execution
continues with the next instruction after the loop.
iteration
true; execution continues past loop when false;
Common Looping Error
is to use the opposite loop expression than intended such as using x == 0 instead
of x!= 0. Programmers should pay extra attention to the fact that the expression
states when the loop is to iterate, not when it is to stop.
infinite loop
is a loop that never ends. A very common error is to accidentally create an
infinite loop, either by forgetting to change a variable in the body, or by writing
a loop expression whose evaluation to false isn't always reachable.
sentinel value
a special value that marks the end of a list, such as a list of positive integers
terminated with 0, as in 10 1 6 3 0.
, while loop
is a loop which, while the loop's expression evaluates to true, repeatedly
executes the loop body
for loop
a loop of the form that includes a loop variable initialization, a loop expression,
and a loop variable update, and which typically describes iteration to be
performed a certain number of times.
for
Number of iterations is calculable prior to the loop, such as iterate N times.
while
Number of iterations is not easily computable before the loop, for example
iterate until input is 'q'.
Nested Loop
A loop that appears inside the body of another. The inner and outer loops are
common names given to the nested loops.
While Loop
A while loop will continue to execute a loop body provided the expression
associated with the while evaluate to True.
while code
In syntax, the while loop contains the keyword "while" followed by the
expression.
Statements of the body of the loop begin on the next line and are indented.
loop
a language construct that re-executes a series of instructions, the so-called loop
body, as long as the controlling expression evaluates to true; then execution
continues with the next instruction after the loop.
iteration
true; execution continues past loop when false;
Common Looping Error
is to use the opposite loop expression than intended such as using x == 0 instead
of x!= 0. Programmers should pay extra attention to the fact that the expression
states when the loop is to iterate, not when it is to stop.
infinite loop
is a loop that never ends. A very common error is to accidentally create an
infinite loop, either by forgetting to change a variable in the body, or by writing
a loop expression whose evaluation to false isn't always reachable.
sentinel value
a special value that marks the end of a list, such as a list of positive integers
terminated with 0, as in 10 1 6 3 0.
, while loop
is a loop which, while the loop's expression evaluates to true, repeatedly
executes the loop body
for loop
a loop of the form that includes a loop variable initialization, a loop expression,
and a loop variable update, and which typically describes iteration to be
performed a certain number of times.
for
Number of iterations is calculable prior to the loop, such as iterate N times.
while
Number of iterations is not easily computable before the loop, for example
iterate until input is 'q'.
Nested Loop
A loop that appears inside the body of another. The inner and outer loops are
common names given to the nested loops.
While Loop
A while loop will continue to execute a loop body provided the expression
associated with the while evaluate to True.
while code
In syntax, the while loop contains the keyword "while" followed by the
expression.
Statements of the body of the loop begin on the next line and are indented.