Anheuser-Busch InBev interview question

Coding interview in python. Explain the code you have done