Pregunta de entrevista de Triplebyte

Code basic Python function as given