Attune Insurance interview question

Re-write/expand upon this code so that does [X] and looks like [Y[.