クラスソリューション: 「」」 @param A:整数配列 @return:何も 「」」 デフsortIntegers(自己、A): new_list =リスト(A) list_len = LEN(new_list) 私のための範囲内で(list_len): 範囲(I + 1、list_len)でjに対して: もしnew_list [I]> new_list [J]: new_list [i]は、new_list [J] = new_list [J]、new_list [I] リターンnew_list __name__ == "__main__" の場合: test_input =のeval(入力( "配列を入力してください:")) そう=ソリューション() 印刷(so.sortIntegers(test_input))
テスト結果