Python *MIX_W2

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.