JLR interview question

Stack Implementation in python