Finished frequency.py for Problem 4