Completed version of analysis script

for Peer Assignment