Python learning log for small y-data type (if loop)

Source: Internet
Author: User

#本文仅为个人学习过程的整理和记录, if there is a blog from others, the site extracts the content, I will clearly mark, if there is infringement, please contact me, I will be deleted in the first time.

The following information is compiled from the (1) Liaoche python tutorial http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000

(2) Concise python tutorial http://woodpecker.org.cn/abyteofpython_cn/chinese/

1. Process Control

(1) If statement

1) The If statement contains a logical expression, using an expression comparison, to make a decision based on the results of the comparison.

2) If expression:

Statement (s)

Note: Python uses indentation as a method of grouping its statements, and it is recommended to use 4 spaces instead of indents

3) The logical value (BOOL) is used to denote such concepts as: Right and wrong, true and false, empty and non-empty.

The logical value consists of two values:

True: Indicates non-empty quantities (e.g. string,tuple,list,set,dictonary, etc.), all non-zero

False: Indicates 0,none, empty amount, etc.

Function: Mainly used in interpreting sentences for judging

Whether a string is empty

Whether the result of an operation is zero

Whether an expression is available

(2) Else statement:

If expression:

Statement (s)

Else

Statement (s)

If the conditional expression if statement resolves to a value of 0 or FALSE, the Else statement is executed.

Else statement is an optional statement that cannot be used alone and can have at most one else statement

(3) elif statement:

If expression:

Statement (s)

Elif expression2:

Statement (s)

Elif Expression3:

Statement (s)

Else

Statement (s)

The Elif statement can check that multiple expressions are true and executes a block of code, and the Elif statement is optional. There can be any number of elif statements.

Python learning log for small y-data type (if loop)

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.