Micro Trends interview question

Python coding problem with zero guidance