The input () function pauses the program while the user enters some text

///

Use int () to get numeric input

///

Introduction to the While loop

///

Let the user choose when to quit

Set message to an empty string before the while loop so that the first loop can pass through otherwise message will fail to define the first loop

///

Use sign

In a program that requires many conditions to continue running, you can define a variable to determine whether the entire program is active. This variable is called the flag

///

Use break to exit the loop

To exit the while loop immediately, without running the rest of the code in the loop, and regardless of the result of the conditional test, use the break statement.

While True causes the loop to continue

When the user enters quit, the if statement is executed to break to exit the loop

The break statement can be used in any Python loop. For example, you can use the break statement to exit the **for loop ** that traverses a list or dictionary

///

Use continue in the loop

Print only odd numbers

///

An infinite loop

Ctrl+C can exit the infinite loop

///

Use a while loop to process lists and dictionaries

:

Move elements between lists

///

Deletes all list elements that contain a particular value

In Chapter 3, remove () is used to remove specific values from a list, but only one value at a time. (This is not useful when a list has several specific values.)

So you can keep running a while loop until the list no longer contains the value ‘cat’

///

Use user input to populate the dictionary

You can use a while loop to prompt the user for any amount of information

///