UKCloud Interview Question

Asked to write a function.