code for 8th lecture