solve by python