Python flow control if… else statement

A more commonly used function in program design is to execute a certain program code segment when the condition is judged as True, and when the condition judges to be False, execute another piece of program code. At this time, you can use the if...else statement. Its syntax format is as follows:

In the above code, if the conditional judgment is True , the program code segment 1 is executed ; if the conditional judgment is False , the program code segment 2 is executed . The following flow chart can be used to illustrate this if...else statement:

Guess you like

Origin blog.csdn.net/m0_55389447/article/details/114726529