python--judgment, Loop statement

Source: Internet
Author: User

Simple Judgment statement:If ...

A judgment statement:if... else ...

Multiple judgment statements:if elif else ...

Score=input ("Please enter your score")

Score=int (Score)

If score<60:

Print ("unqualified grades")

Elif 60<=score<80:

Print ("score is good")

Elif 80<=score<90:

Print ("score is excellent")

Else

Pass

If statement execution has a feature, it is judged from the top down, if it is true on a certain judgment, the sentence

When the corresponding statement is executed, the remaining elif and else are ignored.

Loop statement:

For x in ...

for loop, Traverse ....

Example : Forx in list

For x in range ()

Range() function

Can generate a sequence of functions, starting from zero

list (range) is a 0 -to-one listing

For I in range (len,-1,-1)

python--judgment, Loop statement

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.