Starting from hints/ex2.py, implement a Polynomial class with the following features:
Constructor and string representation:
Polynomial(1, 2, 3) represents __repr__ to print: "1 + 2x + 3x^2".Operator overloading:
__add__ for polynomial addition.Polynomial(1, 2) + Polynomial(3, 4) → "4 + 6x".Inheritance and polymorphism:
evaluate(self, x) (x can be a single point or a list).StandardPolynomialEvaluator: implements standard evaluation.HornerPolynomialEvaluator: implements Horner's rule.@measure_time decorator.Hints:
time.time() or time.perf_counter() in the decorator.Refactor the existing data processing code provided in hints/ex3.py into a modular package with multiple modules, functions, and classes.
dataprocessordataprocessor/
├── __init__.py # Package entry point.
├── operations.py # Data processing functions.
└── data_analysis.py # DataAnalyzer class.
__init__.py: Import and export necessary functions and classes. Define __all__ to control what the package exports with from dataprocessor import *. In particular, it should export process_data, additional_operation, DataAnalyzer, pd.operations.py: Contains functions for data processing:
process_data(df, column1, column2, result_column): Adds values from two columns.additional_operation(df, column1, column2, additional_column1, other_column2): Performs multiplication and division operations.data_analysis.py: Contains a class DataAnalyzer, replacing DataProcessor, that encapsulates data analysis functionality:
analyze_data(df) returns mean and max values.main_dataprocess.py script that demonstrates the package usage.