Chapter 8 while loop
What are several common patterns that are used to control while loops ?
- interactive loops - sentinel loops -flag controlled loops -count controlled loops -file processing loops
In
-membership test in python -syntax of expression variable in sequence -creates Boolean value -produce true when the variables is in the sequence
True and A
A
A and ( B or C)
A and B or A and C
Break
A command that will cause a python program to exit its enclosing loop immediately
Pre-test loop
A loop style in which the condition is test d at the beginning of each iteration
post-test loop
A loop style in which the condition is tested at the end of each iteration of the loop
Loop and a half
A loop that uses a break statement to exit from the middle of the loop is solid to follow the loop and a half pattern
A or (B and C)
A of B and A or C
A or (A and B)
A or A and A or B
input validation
A programming routine that uses a loop to make the user re-enter some value that is not appropriate for the program at that point
count controlled loop
A programming technique that will increase the value of a variable by some fixed amount upon each iteration of a loop
Menu
A selection list that informs the user of their option in a program
What are pythons Boolean operators?
And and or
How many times is the post-test loop performed ?
At least one time
not (not B)
B
What is input validation also known as ?
Bad data trap
What statement can be executed in the body of a loop to cause it to terminate ?
Break
what is the interactive loop also called ?
Ending option
A break command is used to _____ a program
Exit
What is the important use for an indefinite loop ?
For implementing the programming pattern interactive loop
the ___ ____ is refereed to as the fixed iteration loop
For loops
A loop that never terminates
Infinite
Interactive loop
Is one that is repeated upon demand by the user , usually controlled by asking a user yes/no question & checkinh the response
Sentinel loop
Method uses a special , false value entered as a signal to end the loop . special value is called sentinel value
Indefinite iteration loop
Performed until some condition is met
A loop structure that tests the loop condition after executing the loop body is called a ?
Post-test loop
What type of loop command python does not offer ?
Post-test loop command
while
Python indefinite iteration loop -continues until the Boolean expression is true
What is an example of an indefinite loop ?
Python while
A loop pattern that continues until a special value is input called an ?
Sentinel loop
Flag controlled loop
Uses a boolean variable to indicate whether the loop should be repeated
When is the break command normally used ?
in an If is
not ( A and B)
not A or not B
not ( x>0 and y<=10)
not x>0 or y<=10