Python Beginner Learning Basics Conditional Statement--IF/ELSE statement

Source: Internet
Author: User

If/else statements

Conditional statements actually in the previous article we have used several times, here we need to re-grand to introduce it, conditional statements are judged by one or more statements of the return result (true or false) to choose to perform the next command, the more commonly used is the IF/ELSE statement, It can be expressed in code like this (pay attention to the direct indentation relationship of the statement OH):

Python code

If condition 1: Execute statement 1 Else: EXECUTE statement 2 if judgment Condition 2: Execute statement 3 else: EXECUTE statement 4

The execution logic of the if/else is that if the judgment condition after the if is fulfilled, the statement block of if is executed, otherwise the statement block of else is executed.

Now I'm going to do a simple task, using the IF Else statement to output the maximum between x and Y.

Think for a moment ~ ~ ~

For more information, please go to the code bud Net

Http://www.mayacoder.com/lesson/index

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/86/F2/wKiom1fPh8OhqDzsAAA-O9VXGZw593.png-wh_500x0-wm_3 -wmp_4-s_735511816.png "title=" 4.png "width=" "height=" 682 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:300px; height:682px; "alt=" Wkiom1fph8ohqdzsaaa-o9vxgzw593.png-wh_50 "/>


Python Beginner Learning Basics Conditional Statement--IF/ELSE 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.