code for 9th lecture