HCL Interview Question

Write production ready python code