List method
lst.append()
(add an element to the end of the list )
lst.append(parameter)
lst.insert()
(insert an element at the specified position of the list)
lst.insert (parameter 1, parameter 2)
parameter 1: the position to be inserted
parameter 2: the element to be inserted
lst.extend()
(Extend the current sequence, it needs a sequence as a parameter, it will add the parameters in the sequence to the current sequence)
lst.pop()
deletes the element according to the index value and returns the deleted element (with return value)
(if there is no index value, the last value is returned by default)
lst.remove()
deletes elements according to the specified element, no return value
lst.clear()
clears the list
lst.reverse() to
reverse the list
lst.sort()
sorts the elements in the list, the default ascending order
Descending order can be performed by reverse
Traverse the list
Refers to extracting the elements in the list
for loop : the code in the for loop will be executed multiple times, and it will execute as many times as there are elements in the sequence
range() function :
format: range(start, end, step)
Start: Default is 0 (starting from 0)
End: Excluding end (close before and open)
Step size: Default is 1