Below is a question which requires you to write a function for it, thought it was interesting that my way of thinking and answer changed to this question with age (not sure if I got smarter or dumber XD)