A branch loop:
INPUT = A ( " Please enter a five-digit number " ) IF (len (A) =. 5! ): Print ( " digital input substandard " ); elif (A [:: 0] == A [-1: : -1 ]): Print ( " {} is a palindrome " .format (the eval (A))) the else : Print ( " {} is not a palindrome " .format (the eval (A)))
This is typically used if-elif-else statement to determine the output of the branch, of course, can be nested if statements , Python is used to distinguish between a block of statements indented
So branch judgment statement indentation has strict requirements
Two, the Continue and break:
continue is out of this cycle, but the cycle is not interrupted; break is the direct end of the cycle, the following statement is not executed.
INPUT = a_num ( " Please enter an integer: " ) for a_num in Range (1,101 ): IF (a_num. 7% == 0): Continue Print (a_num, End = " " )
Here continue skip number is divisible by 7, the number of 0 to 100 other output, output only 7 will break over, will not go cycle.