completed frequency.py