Solution to a lab assignment