Skip to content

Problem definition #2

Description

@chadbrewbaker

The output of this sort is correct? Just making sure I understand the problem definition.

tr -s ' \t' '\n' < data/small.data | sort | uniq -c | sort -ns

As a hilarious aside - I think I found some issues in /usr/bin/sort on OSX https://opensource.apple.com/tarballs/text_cmds/ 😂

-- update --
This is close - still need to secondary alpha sort

import sys
from collections import Counter

fpath = sys.argv[1]

with open(fpath, 'r') as f:
    data = f.read()
  
freq = Counter(data.split())

result = freq.most_common()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions