>>> WordCount('a', 1).__lt__(WordCount('b', 1)) False >>> WordCount('a', 1).__lt__(WordCount('a', 1)) False >>> WordCount('a', 1).__lt__(WordCount('a', 2)) True >>> WordCount('a', 1).__lt__(WordCount('b', 2)) True >>> WordCount
(self, other: object)
| 43 | return self.count == other.count |
| 44 | |
| 45 | def __lt__(self, other: object) -> bool: |
| 46 | """ |
| 47 | >>> WordCount('a', 1).__lt__(WordCount('b', 1)) |
| 48 | False |
| 49 | >>> WordCount('a', 1).__lt__(WordCount('a', 1)) |
| 50 | False |
| 51 | >>> WordCount('a', 1).__lt__(WordCount('a', 2)) |
| 52 | True |
| 53 | >>> WordCount('a', 1).__lt__(WordCount('b', 2)) |
| 54 | True |
| 55 | >>> WordCount('a', 2).__lt__(WordCount('a', 1)) |
| 56 | False |
| 57 | >>> WordCount('a', 2).__lt__(WordCount('b', 1)) |
| 58 | False |
| 59 | >>> WordCount('a', 1).__lt__(1) |
| 60 | NotImplemented |
| 61 | """ |
| 62 | if not isinstance(other, WordCount): |
| 63 | return NotImplemented |
| 64 | return self.count < other.count |
| 65 | |
| 66 | |
| 67 | def top_k_frequent_words(words: list[str], k_value: int) -> list[str]: |
nothing calls this directly
no outgoing calls
no test coverage detected