UKCloud interview question

Asked to write a function.