3. There are no switch–case statements in Python. Python3 Loop StatementsThis section will introduce you to the use of the Python loop statement.
The looping statements in Python have for and while.
The control structure diagram for the Python loop statement is as follows:
While loopThe general form of a while statement in Python:
While judgment condition: statement
For statementA Python for loop can traverse any sequence of items, such as a list or a string.
Break and continue statements and ELSE clauses in loopsThe break statement can jump out of a for and while loop body. If you terminate from a for or while loop, any corresponding loop else blocks will not execute; The continue statement is used to tell Python to skip the remaining statements in the current loop block and then proceed to the next round of loops.
Pass StatementThe Python Pass is an empty statement in order to maintain the integrity of the program structure.
Pass does not do anything, generally used as a placeholder statement
#for loop 1-100 of all integers and
Sum=0
For I in Range (1,101):
Sum=sum+i
Print (sum)
Use for To print 99 multiplication table
For I in Range (1,10):
For j in Range (1,i+1):
#print (' {}x{}={}\t '. Format (j, I, I*j), end= "")
Print ("%d*%d=%d"% (j,i,i*j), end= "")
Print ()