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
sortedto sort any iterable collection. It always a (new) list containing sorted data. Some mutable collections (e.g., list) have thee methodsortto sort elements in-place. BothsortedandCollection.sortaccept an argumentkeyfor specifying customized sorting criteria.