completed assignment 4 with loops & blocks