FactSet Interview Question

How would you simplify this code?