diff --git a/u9/huffman_tree.py b/u9/huffman_tree.py index 9686aca..b5146b4 100644 --- a/u9/huffman_tree.py +++ b/u9/huffman_tree.py @@ -53,6 +53,9 @@ class HuffmanTree: return self.root def codes(self): + if self.root.left is None and self.root.right is None: + return {self.root.data: "0"} + codik = {} if self.root is None: return {}