Apple Interview Question

To write a definition in python.