4.1, 4.2 and 4.3 scripts for Exercise 4 in Appendix