Python provides a while loop with a for loop, noting that do...while loops are not provided.
The loop control statements are:
1) Break: Terminates the current loop and exits the entire loop body;
2) Continue: Terminates the current loop, jumps out of this cycle, executes the next cycle;
3) Pass: Empty statement, in order to maintain the integrity of the program structure;
1. While loop:
While judging condition: Execute statement ...
Count = 0while (Count < 9): print ("Count =%d"% count) count++ print ("Exit")
# Wireless Loop while True:print ("while loop")
2. For loop: You can traverse any sequence of items, such as a list or a string.
For Iterating_var in Sequence:statements (s)
For the "Hello World": print ("Current letter:", letter) for I in range: print (i) fruits = [' apple ', ' ba Nana ', ' orange ']for fruit in fruits:print (fruit)
Getting Started with Python (iv) Looping statements