changing directory to meet assignment 1 condition