Answer and implementation of python code with part of analysis.