UBS Interview Question

Blocks of code in python and the expected outcome