[Sic] [Python] sequence introductory and advanced - list traversal
0: Lead
"" A: through the list, using the cycle
"" b: circulating successively traversing element in the list is taken out
1: traverse the list
Essentially means that a loop elements in the list taken
Figure:
elements of this traverse, the biggest drawbacks is the list of more than one, such as 100, the code you wrote numb
1.1 while loop
So long as the cycle can be written as
1.2 for loop to iterate through the list
summary:
grammar:
Cycle principle:
"" 1: Each time will be assigned to a variable element in the sequence
, "" 2: There are several elements in the sequence will be performed several times
2: range () is a function
It can be used to generate a sequence of natural numbers
2.1: Creating a sequence
For example: to create an integer of 0 to 4.
FIG:
This display is not essential
Essentially
This generates a sequence of [0,1,2,3,4]
It can be used to loop through out
2.2: three parameters
Description:
1. The starting position parameters (may be omitted, the default is 0)
reference end position 2.
Reference 3. The step (can be omitted, the default is 1)
If the step is negative, it represents the largest to smallest
2.3: The range () can create an execution for a specified number of cycles
(Apparently, because for when creating the sequence, the code simpler)