added script 3 of stanford assignment1