7.3. Sequence Methods - JulTob/Python GitHub Wiki
Sequence Methods
Statements for sequential types.
x in sq # sq contains x
x not in sq # sq not contains x
sq1 + sq2 # Concatenates/Merges
sq * n # Multiplies
sq *= n # Multiplies and actualizes
sq[i] # ith element, first index is 0
sq[i:j] # Subset i-j
sq[i:j:k] # Subset i-j skipping k
len(sq) # Length of sq
min(sq) # Minimum
max(sq) # Maximum
sq.index(x) # Returns the index of the first x value
sq.index(x,i) # "" after i
sq.index(x,i,j) # "" after i and before j
sq.count(x) # counts x values
del sq[i:j] # Deletes slice
sq.append(x) # Appends x
sq.clear() # Deletes all content
sq.extend(sq2] # Extends with sq2
sq.insert(i,x) # Inserts x the ith position
sq.pop() # Returns last and deletes from sq
sq.pop(i) # Returns ith and deletes from sq
sq.remove(x) # Deletes first x in sq
sq.reverse() # Reverses sq