homework 2

I looked at the answer to get this. I understand what it's doing. When I tried it on my own I think I just had trouble getting the right syntax.