Python code of study