Algorithm For Stack Using Array In Python Problem