add Q1231 solution with python