lecture 4 code