1. Cycle:
Execution process:
1. Determine if the condition is true. If it's true. Execute code block
2. Again to determine whether the condition is true ...
3. When the condition is false. Execute else jumps out of the loop. The loop ends.
While condition:
code block (also called loop body)
---------------------------------------------------------------
While True: * Dead Loop
code block
--------------------------------------------------------------
The operation of the while loop:
Break * Interrupts, jumps out, terminates the current layer loop.
Continue * Stop the current loop and proceed to the next loop. (* generally used to exclude)
Break does not trigger the execution of else;
else is to execute the code in this else when the above conditions are not true;
While...else ... is a whole, break the time to completely stop this whole.
2. Formatted output:
%s: A placeholder for a string that can be placed in any content. (Contains numbers)
%d: Placeholder for number
Format:
%s% (content) * entered sequentially, separated by commas.
Note that %s and subsequent% have conflicts , if you need to use% in code that has formatted input, you want to double-write the percent sign that is not a placeholder.
Example 50%, need to write 50%
3. Operators:
Logical operation:
And and the meaning. Both left and right values must be true. The result of the operation is true
The meaning of OR OR. The left and right sides have one that is true. The result is true. All is false. The result can be false
The meaning of not. It turned out to be false. It's true now. Not true or false, not false both true
Sequence of operations for logical operations:
(in parentheses) →not→and→or * The same sequence of operations is calculated from left to right
* And and or are in the opposite order of values
False when 0 looks, but not 0 true when not 0 look
Python *MIX_W2