My QA Projects

QA Projects I was involded.

View on GitHub

Sequences

Main characteristics:

Sequence Mutable
List YES
Tuple NO
String NO
Range NO

Set and Dictionaries => no sequences.


seq1 == seq2
# check if same content
seq1 != seq2
# check if not have same content
sequence[n]
# return nth item in sequence
sequence[start:stop]
# return slice with items between index start and stop (excusive) in sequence
item in sequence
# check if an item exists in sequence
sequence1 + sequence2
# must be of the same type

Sequence Functions

len(sequence)
# return length

max(sequence)
# return largest value

min(sequence)
# return the smallerst value

sorted(sequence, reverse=False)
# return a list with items sorted in ascending order 
# if reverse is True, sort in descending

reversed(sequence)
# return a copy of a sequence in reverse order

Sequence Methods

sequence.count(item)
# return the number of times item occurs in sequence

sequence.index(item)
# return the index of item in sequence, ValueError if not found

back