Interview Practice: Write and Test a Python Function

Who knew an interview practice is going more complicated for a developer. Here is a common one I head in terms of writing a Python function: