Monotonic Stack Python Problem For Beginners