This is a draft cheat sheet. It is a work in progress and is not finished yet.
Modification
operation |
Python |
Q |
adding item |
|
|
insert |
|
|
delete all |
|
|
pop |
|
|
remove single |
|
|
remove multiple |
[e for e in l1 if e not in l2]
|
|
deleteby index |
|
|
Similarities on general list
operation |
Python |
Q |
length |
|
|
reverse |
|
|
first part |
|
|
last part |
|
|
middle part |
|
|
|
|
operations on list of numbers
operation |
Python |
Q |
minumum |
|
|
average |
|
|
variance |
statistics.variance(l)
|
|
cummulative sum |
list(itertools.accumulate(l, operator.add))
|
|
cummulative prod |
list(itertools.accumulate(l, operator.mul))
|
|
Split and Join
operation |
Python |
Q |
join |
|
|
split |
|
|
|
|
|