Updated script for Problem 3

Updated script for Problem 3