Home > other >  The for loop import library functions
The for loop import library functions

Time:04-09

16. Do statement
According to a certain number of cycles of a set of statements
For & lt; Variable & gt; In the range (& lt; Parameter & gt;)
Tip: a method of the output of the print function will output all kinds of information in the middle with funny
After separation, output, no can increase the space between the output string, such as:
For I in range (5) :
Print (" Hello ", I)
? 1
? 2
Hello: 0
Hello: 1
Hello: 2
Hello: 3
Hello: 4
Range () function
Cycle counting sequence
(1) the range (N)
0 to N - 1 integer sequences, a total of N
Range (5)
The 0,1,2,3,4
(2) the range (M, N)
M to N - 1 integer sequences, a total of N - M a
Range (2, 5)
The output of 2 and 4
Turtle in the code. The done () function after the program runs, the effect of application won't refund
Out, need to manually exit, if need after the program automatically closed, then delete the line
The code can,

Round (x, y) for x y decimal decimal places, if x in the middle (n. 5) value, to the even integer
Example: round (13.5)=14 round (12.5)=12

Function can be divided into:
The built-in library, library system (import), the third party libraries
  • Related