Added part 3 and 4 to hw2b.py