EPAM Systems Interview Question

Working code for simple python question is expected