Tuple in Rust
Map in Rust
Count Frequencies of Elements Using collections.Counter in Python
Tips¶
collections.Counter
is similar to a dict
object.
You can iterate through it similarly to how you iterate through a dict
.
Sort Collections in Python
Tips¶
- You can use the built-in function
sorted
to sort any iterable collection. It always a (new) list containing sorted data. Some mutable collections (e.g., list) have thee methodsort
to sort elements in-place. Bothsorted
andCollection.sort
accept an argumentkey
for specifying customized sorting criteria.