Print. The print statement can be used to print multiple values separated by commas. If the statement ends with a comma, subsequent print statements continue printing on the same line.
Import. Sometimes you don't like the name of the function you want to import--and it's possible for other reasons to use the name. You can use import...as ... The statement makes a local rename of the function.
Assigned value. Through the sequence unpacking and chaining assignment function, multiple variable assignment can be assigned at once, and the variable can be changed in situ by increment assignment.
Block. A block is a way of grouping statements by indenting them. They can be used in conditions as well as in loop statements, or in functions and classes.
Conditions. Conditional statements can be executed either by a condition (Boolean expression) or by not executing a block of statements. Several conditions can be used in tandem with If/elif/else. Another variant of this topic is the conditional expression, which is shaped like a if B else c.
Assertion. The assertion is simply to be sure that something (Boolean expression) is true, and you can follow the reasons behind it. If the expression is false, the assertion causes the program to crash (in fact, it produces an exception). A better way is to find a mistake sooner or later than to let the error lurk in the program until you don't know where it originated.
Cycle. You can execute a block of statements for each element in a sequence, such as a number in a range, or continue executing a statement when the condition is true. You can use the Continue statement to skip the other statements in the block and then continue the next iteration, or use the break statement to jump out of the loop. You can also choose to add an else clause at the end of the loop, and the contents of the ELSE clause are executed when the break statement inside the loop is not executed.
List derivation. It is not a real statement, but rather an expression that looks like a loop. With a list deduction, you can generate new lists from the old list, apply functions to elements, filter out unwanted elements, and so on. This is a powerful feature, but in many cases, using loops and conditional statements directly (work can be done), the program is easier to read.
Pass, Del, exec, and eval statements. The pass statement does nothing and can be used as a placeholder. The DEL statement is used to delete a variable, or part of a data structure, but cannot be used to delete a value. The EXEC statement executes the string in the same way that the Python program executes. The built-in eval function evaluates an expression written in a string and returns the result.
conditions, loops, and other statements