while loop
1.while basic grammar
One loop of the program three processes:
order - from top to bottom execute code in a sequential manner
branch of the process - based on the condition judgment, decided to branch the code to be executed - rich code form
cycle - make specific code Repeat - Liberation programmers fearless duplication of work output [10000] times hello
The basic syntax:
while condition (determination counter reaches the target number of times):
<> do repeat
<> treatment conditions (counter + 1)
Infinite loop: the program has been executed, can not be terminated, it may cause the counter because there is no handler.
The results recorded on a variable defined above the body of the loop, the loop is calculated. Counting Method: count from zero count.
Nested while loop, a large loop to do some further operation cycle, the cycle can be used nested loops. (Output of the multiplication table)
2.break continue
break: When a certain condition is met, using the break out of the loop is not executed subsequent cyclic code
continue: when a certain condition is met, without a subsequent code directly determines cycling conditions. (Note update counter, or an endless loop)
3. escape character
\ T: output symbols tab
\ n-: newline
\ ': output quotes
4. assignment operator
No pyhton ++ and - (no self-imposed nor decrementing)
the Python the assignment operator, and the current variable behind arithmetic variables, then stores the result in a variable current
c + = a is equivalent to c = a B +,
the C-equivalent to A = c = c + a
5.Print function output line breaks
print function automatically at the end of output add a wrap, wrap undesirable output at the end: print (, end = '' '*'), the latter replaces the contents of the original default end wrap.