added first two parts in hw2b.py