enhancement (#803)

This commit is contained in:
Níkolas Vargas 2019-05-16 08:20:42 -03:00 committed by John Law
parent 76061ab2cc
commit c47c1ab03c

View File

@ -29,12 +29,7 @@ def parse_file(file_path):
if not c:
break
chars[c] = chars[c] + 1 if c in chars.keys() else 1
letters = []
for char, freq in chars.items():
letter = Letter(char, freq)
letters.append(letter)
letters.sort(key=lambda l: l.freq)
return letters
return sorted([Letter(c, f) for c, f in chars.items()], key=lambda l: l.freq)
def build_tree(letters):
"""