Python's Way "first": Python Basics (6)

Source: Internet
Author: User

Conditional judgment if else syntax ruleIfIfStatement is judged asTrue,It will execute the following sub-code< Span style= "FONT-FAMILY:SIMSUN; font-size:12pt; Color: #000000; Font-style:normal; Font-variant:normal; " >< Span style= "Font-family:cambria; font-size:12pt; Color: #000000; Font-style:normal; Font-variant:normal; " > ( Otherwise, execute the sub-code below the El se. Of course, back.El SE not necessarily. and and or grammar rules

Look here write if user_input = = Valid_user and passwd = = valid_passwd:& #0, meaning that if condition must satisfy 2 conditions at the same time, of course, you can also

Then write 1 and, 2 and ... n and, the IF condition must satisfy n conditions to execute the syntax below it, but the normal person does not write & #0; too many and, because the readability is too poor. So a general if judgment satisfies 1 to 3 conditions at the same time; the grammar corresponding to and is either, "or" means, and is the meaning of "with", that is, satisfies 1 or another 1 or 1 conditions ... Conditional Judgment Elif Grammar rules

elif means that if the first if condition is not met, the program will continue to go down and then determine whether the elif condition is met. If not, just keep going (here you can add moreElifJudgment), as soon as it encounters a< Span style= "font-family:menlo-regular; font-size:10pt; Color: #000000; Font-style:normal; Font-variant:normal; " >< Span style= "FONT-FAMILY:SIMSUN; font-size:10pt; Color: #000000; Font-style:normal; Font-variant:normal; " >< Span style= "FONT-FAMILY:SIMSUN; font-size:10pt; Color: #000000; Font-style:normal; Font-variant:normal; " >< Span style= "FONT-FAMILY:SIMSUN; font-size:10pt; Color: #000000; Font-style:normal; Font-variant:normal; " If the final condition is not met, the final line Elif can write multiple lines

Python's Way "first": Python Basics (6)

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.