如图,在调用函数时出现了问题,我已经给了参数,报错是没有提供target的参数,是调用参数哪里错误了吗?谢谢了
class Solution(): def twosum(self, nums, target): index = [] numssort = nums[:] numssort.sort() i = 0 j = len(nums)-1 while i < j: if numssort[i] + numssort[j] == target: for k in range(0, len(nums)): if numssort[i] == nums[k]: index.append(k) break for k in range(len(nums), -1, -1): if numssort[j] == nums[k]: index.append(k) break index.sort() break elif numssort[i] + numssort[j] > target: j = j - 1 elif numssort[i] + numssort[j] < target: i = i + 1 return (index[0], index[1]) myinput = Solution.twosum([3, 2, 4], 6)